How to prevent the screen from sleeping in iOS Programmatically?
When most apps have no touches as user input for a short period, the system puts the device into a "sleep” state where the screen dims. This is done for the purposes of conserving power
By using this property isIdleTimerDisabled we can stop the iOS screen sleeping mode. When it is set to true means the screen will never dim or sleep while your app is running.
When it is set to true - we don’t want to waste users battery life
UIApplication.shared.isIdleTimerDisabled = true