I need to schedule a Timer for firing a function every second but I see that in xcode 8 beta 3 the scheduledTimer is only available for iOS 10. Is there any alternative for using the timer in iOS 9 or previous versions?
Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: { (timer) in print("Hi!")})
The correct form is:
Put it in the main thread.
Solved using
Run a timer with swift3,
Release the timer when you not use it.
Here is sample code workable with compatibility:
//Your method or function:
Swift 3