TheBestClockAppDelegate
@UIApplicationMain
class TheBestClockAppDelegate : UIResponder, UIApplicationDelegate
-
This is a special variable that holds the screen brightness level from just before we first change it from the app. We will use this to restore the original screen brightness.
Declaration
Swift
static var originalScreenBrightness: CGFloat!
-
This refers to the main controller
Declaration
Swift
var theMainController: MainScreenViewController!
-
Used to possibly force orientation for the Alarm Editor Screen.
Declaration
Swift
var orientationLock: UIInterfaceOrientationMask
-
This is the required app window object.
Declaration
Swift
var window: UIWindow?
-
This returns the application delegate object. Nil if an error (should never happen).
Declaration
Swift
class var delegateObject: TheBestClockAppDelegate! { get }
-
This is a class function to display an error.
Declaration
Swift
class func reportError(heading inHeadingKey: String, text inDetailedTextKey: String, presentedBy inPresentingViewController: UIViewController! = nil)
Parameters
heading
The heading. It will be localized.
text
Detailed text to be displayed under the heading. It, too, will be localized.
presentedBy
The presenting ViewController. It can be omitted. If nil (omitted), the alert will use whatever top controller the app delegate can find.
-
If the brightness level has not already been recorded, we do so now.
Declaration
Swift
class func recordOriginalBrightness()
-
This restores our recorded brightness level to the screen.
Declaration
Swift
class func restoreOriginalBrightness()
-
This will force the screen to ignore the accelerometer setting.
Declaration
Swift
class func lockOrientation(_ orientation: UIInterfaceOrientationMask)
Parameters
orientation
The orientation that should be locked.
-
This will force the screen to ignore the accelerometer setting and force the screen into that orientation.
Declaration
Swift
class func lockOrientation(_ orientation: UIInterfaceOrientationMask, andRotateTo rotateOrientation: UIInterfaceOrientation)
Parameters
orientation
The orientation that should be locked.
andRotateTo
The orientation that should be forced.
-
Declaration
Swift
func applicationDidFinishLaunching(_ application: UIApplication)
-
We force the main controller to lay out its subviews, which will restore its internal brightness level.
Declaration
Swift
func applicationDidBecomeActive(_ application: UIApplication)
-
We force the main controller to lay out its subviews, which will restore its internal brightness level.
Declaration
Swift
func applicationWillEnterForeground(_ application: UIApplication)
-
We restore the screen to its original recorded level.
Declaration
Swift
func applicationWillTerminate(_ application: UIApplication)
-
We restore the screen to its original recorded level.
Declaration
Swift
func applicationWillResignActive(_ application: UIApplication)
-
We restore the screen to its original recorded level.
Declaration
Swift
func applicationDidEnterBackground(_ application: UIApplication)