code not working in did enter in background method.
func applicationDidEnterBackground(_ application: UIApplication) {
UIScreen.main.brightness = CGFloat(0.5)
}
code not working in did enter in background method.
func applicationDidEnterBackground(_ application: UIApplication) {
UIScreen.main.brightness = CGFloat(0.5)
}
I tried to do this in the applicationWillResignActive and seems to achieve what you are looking for. Not sure if this is recommended behaviour though.
Here are my methods from AppDelegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
UIScreen.main.brightness = 1.0;
return true
}
func applicationWillResignActive(_ application: UIApplication) {
UIScreen.main.brightness = 0.5
}