i am trying to do an application which can make a timer run in background.
here\'s my code:
let taskManager = Timer.scheduledTimer(timeInterval: 10,
As others pointed out, Timer cannot make a method run in Background. What you can do instead is use while loop inside async task
DispatchQueue.global(qos: .background).async { while (shouldCallMethod) { self.callMethod() sleep(1) } }