Adjust the main screen brightness using Swift
Actually in Swift 3 mainScreen
was replaced with main
, so proper code is:
UIScreen.main.brightness = CGFloat(0.5)
https://developer.apple.com/documentation/uikit/uiscreen/1617830-brightness
From the docs the proper answer for Swift 3+ is:
UIScreen.main.brightness = CGFloat(0.5)