1

I am trying to either default an ios app to a particular brightness when its opened. Is this possible? If so what packages do I need to use?

If this is not possible can I have a brightness scroll bar within the app itself?

Thank you!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 1
    https://stackoverflow.com/questions/24264673/adjust-the-main-screen-brightness-using-swift discusses setting brightness, then just apply whatever default value you want – CodeBender Jan 07 '19 at 19:43
  • Possible duplicate of [Adjust the main screen brightness using swift](https://stackoverflow.com/questions/24264673/adjust-the-main-screen-brightness-using-swift) – Cœur Jan 09 '19 at 07:47

2 Answers2

0

To set screen brightness, Try this code

UIScreen.main.brightness = CGFloat(0.5)
Vikash Kumar
  • 642
  • 1
  • 11
  • 25
0

You can check this article.

import UIKit
extension UIScreen
{
    static func setMainBrightness(brightness: CGFloat)
    {
        guard (0...1).contains(brightness) else
        {
            print("Attempt to set the screen brightness to an invalid value: \(brightness) should be between 0 and 1 inclusive.")
            return
        }
        self.main.brightness = brightness
    }
}
Arif Dogan
  • 35
  • 1
  • 8