BrightnessToggle 0.1.1

BrightnessToggle 0.1.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Mar 2016
SPMSupports SPM

Maintained by Lammert Westerhoff.



  • By
  • Lammert Westerhoff

BrightnessToggle

BrightnessToggle lets you toggle between maximum screen brightness and back on iOS.

Features

  • [x] Toggle to maximum screen brightness and back
  • [x] Restore original brightness when app goes to background

Requirements

  • Swift 2.0
  • iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 7.2+

Installation

Embedded frameworks require a minimum deployment target of iOS 8 or OS X Mavericks (10.9).

Usage

Setting the screen to maximum brightness

import BrightnessToggle

BrightnessToggle.maxBrightness()

Restoring the previous screen brightness

BrightnessToggle.restoreBrightness()

App state changes

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()
    }

License

BrightnessToggle is released under the MIT license. See LICENSE for details.