How to use Timer in Swift
Issue #212
Pre iOS 10
1 | func schedule() { |
iOS 10+
1 | DispatchQueue.main.async { |
Note that
- It needs to be on the main queue
- Callback function can be public, private, …
- Callback function needs to be
@objc
Original answer https://stackoverflow.com/a/42273141/1418457