This can be done using the Global Dispatch background queue.
Background thread example:
let qualityServiceClass = QOS_CLASS_BACKGROUND let backgroundQueue = dispatch_get_global_queue(qualityServiceClass, 0) dispatch_async(backgroundQueue, { print("This is run on the background queue") // With the help of NSTimer it will hit method after every 5 minutes (300 seconds). _ = NSTimer.scheduledTimerWithTimeInterval(300.0, target: self, selector:
source share