I have a pulse animation that I want to run for 3 or 4 seconds, and am looking for a way to delay and run that animation for that amount of time before segueing to the next screen. I am using the code below for the delay, but it is not working when I call the function.
NSTimer.scheduledTimerWithTimeInterval(NSTimeInterval(3), target: self, selector: "functionHere", userInfo: nil, repeats: false)
Please let me know if you have any ideas.
let pulseAnimation = CABasicAnimation(keyPath: "opacity")
pulseAnimation.duration = 1
pulseAnimation.fromValue = 0
pulseAnimation.toValue = 1
pulseAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
pulseAnimation.autoreverses = true
pulseAnimation.repeatCount = FLT_MAX
XboxOneL.layer.addAnimation(pulseAnimation, forKey: "animateOpacity")
XboxOneR.layer.addAnimation(pulseAnimation, forKey: "animateOpacity")