xcode prevent app from sleep code example Example: prevent iphone to sleep swift UIApplication.sharedApplication().idleTimerDisabled = true