CGA_AppDelegate

@UIApplicationMain
class CGA_AppDelegate : UIResponder, UIApplicationDelegate

The primary application delegate for the app.

  • Displays the given message and title in an alert with an “OK” button.

    Declaration

    Swift

    class func displayAlert(header inHeader: String, message inMessage: String = "", presentedBy inPresentingViewController: UIViewController! = nil)

    Parameters

    header

    a string to be displayed as the title of the alert. It is localized by this method.

    message

    a string to be displayed as the message of the alert. It is localized by this method.

    presentedBy

    An optional UIViewController object that is acting as the presenter context for the alert. If nil, we use the top controller of the Navigation stack.

  • This creates an Array of String, containing the advertisement data from the indexed device.

    Declaration

    Swift

    class func createAdvertimentStringsFor(_ inIndex: Int) -> [String]

    Parameters

    inIndex

    The 0-based index of the device to fetch.

    Return Value

    An Array of String, with the advertisement data in “key: value” form.

  • This creates an Array of String, containing the advertisement data from the indexed device.

    Declaration

    Swift

    class func createAdvertimentStringsFor(_ inAdData: RVS_BlueThoth.AdvertisementData?, id inID: String) -> [String]

    Parameters

    inAdData

    The advertisement data.

    id

    The ID string.

    Return Value

    An Array of String, with the advertisement data in “key: value” form.

  • This will change the app orientation mask to what is provided. It can be used to force orientation of the interface. It records the interface orientation prior to the change, so that can be restored later.

    Declaration

    Swift

    class func lockOrientation(_ inOrientation: UIInterfaceOrientationMask)

    Parameters

    inOrientation

    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(_ inOrientation: UIInterfaceOrientationMask, andRotateTo inRotateOrientation: UIInterfaceOrientation)

    Parameters

    inOrientation

    The orientation that should be locked.

    andRotateTo

    The orientation that should be forced.

  • This will return the app orientation to the state it was before the orientation was locked. This is not 100% perfect. If, for example, the device was landscape, then the user physically rotated it to portrait after this call, the rotation will return to landscape, even if the device is still portrait.

    Declaration

    Swift

    class func unlockOrientation()
  • This is the Bluetooth Central Manager instance. Everything goes through this.

    Declaration

    Swift

    static var centralManager: RVS_BlueThoth?
  • Used to force orientation for the Settings screen.

    Declaration

    Swift

    var orientationLock: UIInterfaceOrientationMask
  • The required window property.

    Declaration

    Swift

    var window: UIWindow?
  • Quick access to the app delegate object.

    Declaration

    Swift

    class var appDelegateObject: CGA_AppDelegate! { get }
  • This will contain our persistent prefs

    Declaration

    Swift

    var prefs: CGA_PersistentPrefs
  • Called upon application initialization and setup.

    Declaration

    Swift

    func application(_: UIApplication, didFinishLaunchingWithOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool

    Parameters

    didFinishLaunchingWithOptions

    Ignored

    Return Value

    True (always)

  • This is used to lock the orientation while the timer editor is up.

    Declaration

    Swift

    func application(_: UIApplication, supportedInterfaceOrientationsFor: UIWindow?) -> UIInterfaceOrientationMask

    Parameters

    supportedInterfaceOrientationsFor

    ignored

  • Called when the application is about to enter the background.

    Declaration

    Swift

    func applicationDidEnterBackground(_: UIApplication)