I am just using NotifcationObserver in viewDidLoad
NotificationCenter.default.addObserver(self, selector: #selector(backgroundRefreshStatusDidChange), name: UIApplication.didEnterBackgroundNotification, object: nil)
and using timer like this
@objc func backgroundRefreshStatusDidChange(notification: NSNotification) { print("New status: (UIApplication.shared.backgroundRefreshStatus)") timer = Timer.scheduledTimer(timeInterval: 0.5, target: self, selector: #selector(timerAction), userInfo: nil, repeats: true) }
When app goes into the background mode, the Timer is Stoped but I want timer to running if app is background mode.