CocoaPods trunk is moving to be read-only. Read more on the blog, there are 13 months to go.
| TestsTested | ✓ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Aug 2016 |
| SPMSupports SPM | ✗ |
Maintained by Michal Konturek.
ScreenBrightness allows you to monitor brightness of your device screen without a hassle.
To run the example project, clone the repo, and run pod install from the Example directory first. Alternatively, you could run the demo by executing pod try ScreenBrightness in your terminal.
NB Screen brigthness of iOS simulators is always 0.5, so make sure you run it on a real device.
To start, simply import ScreenBrightness to your project
import ScreenBrightnessand initialize ScreenBrightness class, set its delegate
let screenBrightness = ScreenBrightness(screen: UIScreen.mainScreen())
screenBrightness.delegate = selfand then implement screenBrightnessDidChange method to start monitoring screen brightness changes.
func screenBrightnessDidChange() {
print(screenBrightness.brightness)
print(screenBrightness.isLight)
}public weak var delegate: ScreenBrightnessMonitoring?A delegate that conforms to ScreenBrightnessMonitoring protocol.
public var brightness: CGFloatReturns screen brightness value.
public var isLight: BoolReturns true if screen brightness is greater than defined threshold.
public var threshold: FloatDetermines if brightness is ligt or dark. Default value is 0.5.
ScreenBrightness is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ScreenBrightness"ScreenBrightness is available under the MIT license. See the LICENSE file for more info.
Thsis repository is inspired by ASCScreenBrightnessDetector by André Schneider.