Although I'm coding in Objective C, this is more of a general programming question.
What is the best way to convert a constantly changing scalar value to a changing interval or frequency?
Right now every time the scalar value changes I am destroying the NSInterval
ie
[self.myTimer invalidate];
self.myTimer = nil;
and creating a new one, but this seems like a VERY expensive way to achieve my goal, since the changing scalar value in my case represents the horizontal velocity of a swipe.
For a rough analogy, think of the speed of a swipe being reflected in a visual metronome, the faster you swipe, the higher(shorter interval) the frequency of the metronome.