apparently the following is not available in swift anymore:
[self performSelector:@selector(onFlip) withObject:nil afterDelay:0.3];
why is this the case if the following is still present:
NSObject.cancelPreviousPerformRequestsWithTarget(self, selector: singleTapSelector, object: nil)
doesn't nsobject.cancel work with performSelector? why have the cancel functionality but not the perform functionality?
Swift is statically typed so the performSelector: methods are to fall by the wayside. Instead, use GCD to dispatch a suitable block to the relevant queue — in this case it'll presumably be the main queue since it looks like you're doing UIKit work.
The usage of this "ValueAnimator" would be similar to a normal Timer/NSTimer, in that you pass a "selector" as an argument and that selector is called each time the ValueAnimator fires: [In Parent Class]: // { ... let valueAnimatorTest = ValueAnimator(durationInSeconds: 10, selector: #selector(self.
Use
NSTimer.scheduledTimerWithTimeInterval(delay, target: self, selector: "onFlip", userInfo: nil, repeats: false)
instead. No idea why the other one is not available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With