Skip to content

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

License

Notifications You must be signed in to change notification settings

lammertw/BrightnessToggle

Repository files navigation

BrightnessToggle

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

Features

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

Requirements

  • Swift 5.0
  • iOS 12.3+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 12.0+

Installation

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

CocoaPods

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

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •