I have a task that needs to be performed every 1 second. Currently I have an NSTimer firing repeatedly every 1 sec. How do I have the timer fire in a background thread (no
class BgLoop:Operation{ func main(){ while (!isCancelled) { sample(); Thread.sleep(forTimeInterval: 1); } } }