NACCAppSceneDelegate

@UIApplicationMain
class NACCAppSceneDelegate : UIResponder
extension NACCAppSceneDelegate: UIWindowSceneDelegate
extension NACCAppSceneDelegate: UIApplicationDelegate

This is a simple application delegate that allows the app to start up.

  • Used for when we store the original state of the app, when called from a URI.

    Declaration

    Swift

    typealias OriginalPrefsTuple = (cleanDate: Date, lastSelectedTabIndex: NACCTabBarController.TabIndexes)
  • Required Window Property

    Declaration

    Swift

    var window: UIWindow?
  • Quick accessor for the app delegate, cast to this class.

    Declaration

    Swift

    private static var _appDelegateInstance: NACCAppSceneDelegate?
  • The name of our default scene configuration.

    Declaration

    Swift

    private static let _sceneConfigurationName: String
  • This will contain the original prefs, if the app was started from a URL (so we reset).

    Declaration

    Swift

    private static var _originalPrefs: OriginalPrefsTuple?
  • This will contain the date for the selectors, if set from a URL.

    Declaration

    Swift

    private var _cleandateFromURI: Date?
  • This is a special flag, for use when opened by a URI. If true, then the app always starts at the initial screen.

    Declaration

    Swift

    private var _resetScreen: Bool
  • This is used to allow a tab to be selected from the URL.

    Declaration

    Swift

    private var _selectedTabFromURI: NACCTabBarController.TabIndexes?
  • This will contain the date for the selectors.

    Declaration

    Swift

    private var _date: Date?
  • This will contain the textual report, for the calculation.

    Declaration

    Swift

    private var _report: String

Private Computed Properties

Internal Computed Class Properties

  • Quick accessor for the app delegate, cast to this class. READ-ONLY.

    Declaration

    Swift

    class var appDelegateInstance: NACCAppSceneDelegate? { get }

Internal Computed Instance Properties

  • This will contain the date for the selectors.

    Declaration

    Swift

    var date: Date? { get set }
  • This will contain the textual report, for the calculation.

    Declaration

    Swift

    var report: String { get set }

Internal Instance Methods

  • This clears the original prefs, and prevents the reset on close.

    Declaration

    Swift

    func clearOriginalPrefs()

UIWindowSceneDelegate Conformance

  • Called when the app is opened via a URL.

    We parse the URL, and set a couple of instance variables, if the URL parameters are correct.

    The URL scheme is thus:

    nacc://[YYYY-MM-DD[/N]]

    YYYY-MM-DD is a standard ISO 8601 calendar date (For example, September first, 1980, is 1980-09-01).

    The earliest date is October 5, 1953 (1953-10-05)

    N is the numerical index of a tab:

    • 0 is Keytag Array
    • 1 is Keytag Strip
    • 2 is Medallions

    Declaration

    Swift

    func scene(_ inScene: UIScene, openURLContexts inURLContexts: Set<UIOpenURLContext>)

    Parameters

    inScene

    The scene instance (ignored).

    openURLContexts

    The Opening URL contexts (as a set).

  • Called when the app is opened via a URL (and launched).

    We simply call the other handler, and use that parse the URI.

    Declaration

    Swift

    func scene(_ inScene: UIScene, willConnectTo: UISceneSession, options inConnectionOptions: UIScene.ConnectionOptions)

    Parameters

    inScene

    The scene instance (ignored).

    willConnectTo

    The session being connected (also ignored).

    options

    This contains the options, among which, is the URL context.

  • Called when the app is about to come into the foreground.

    We use this to set the app to the initial screen, and also, to check if we have a URL specified.

    If we don’t have a URL specified, then we restore to any saved state.

    Declaration

    Swift

    func sceneWillEnterForeground(_: UIScene)
  • Called when the app is about to come into the foreground.

    We use this to set the app to the initial screen, and also, to check if we have a URL specified.

    If we don’t have a URL specified, then we restore to any saved state.

    Declaration

    Swift

    func sceneDidBecomeActive(_: UIScene)
  • Called when the scene will be no longer visible.

    We use this to restore our prefs from any that were stored, when the app was called from a URL.

    Declaration

    Swift

    func sceneDidEnterBackground(_: UIScene)

UIApplicationDelegate Conformance

  • Called when the application starts.

    Declaration

    Swift

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

    Return Value

    true, always.

  • Declaration

    Swift

    func application(_: UIApplication, configurationForConnecting inConnectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration

    Parameters

    configurationForConnecting

    options

    Return Value

    The scene configuration.