BrightnessToggle lets you toggle between maximum screen brightness and back on iOS.
- Toggle to maximum screen brightness and back
- Restore original brightness when app goes to background
- Swift 5.0
- iOS 12.3+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
- Xcode 12.0+
Embedded frameworks require a minimum deployment target of iOS 12.3 or OS X Mavericks (10.9).
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate BrightnessToggle into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '12.3'
use_frameworks!
pod 'BrightnessToggle'
Then, run the following command:
$ pod install
import BrightnessToggle
BrightnessToggle.maxBrightness()
BrightnessToggle.restoreBrightness()
Include the following code in your AppDelegate
to automatically restore brightness when the user leaves the app and set it again to maximum brightness when the app becomes active again (if it was at a maximum when the app became inactive):
func applicationWillResignActive(_ application: UIApplication) {
BrightnessToggle.applicationWillResignActive()
}
func applicationWillEnterForeground(_ application: UIApplication) {
BrightnessToggle.applicationWillEnterForeground()
}
BrightnessToggle is released under the MIT license. See LICENSE for details.