NACCAppSceneDelegate
@UIApplicationMain
@MainActor
class NACCAppSceneDelegate : UIResponder
extension NACCAppSceneDelegate: UIApplicationDelegate
extension NACCAppSceneDelegate: UIWindowSceneDelegate
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
@MainActor var window: UIWindow?
-
Quick accessor for the app delegate, cast to this class.
Declaration
Swift
@MainActor private static var _appDelegateInstance: NACCAppSceneDelegate?
-
The name of our default scene configuration.
Declaration
Swift
@MainActor private static let _sceneConfigurationName: String
-
This will contain the original prefs, if the app was started from a URL (so we reset).
Declaration
Swift
@MainActor private static var _originalPrefs: OriginalPrefsTuple?
-
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
@MainActor private var _resetScreen: Bool
-
This is used to allow a tab to be selected from the URL.
Declaration
Swift
@MainActor private var _selectedTabFromURI: NACCTabBarController.TabIndexes?
-
This will contain the date for the selectors.
Declaration
Swift
@MainActor private var _date: Date?
-
This will contain the textual report, for the calculation.
Declaration
Swift
@MainActor private var _report: String
-
The ID for the “Display Cleantime” activity.
Declaration
Swift
@MainActor static let displayCleantimeID: String
-
The ID for the “Display Cleantime” activity data field.
Declaration
Swift
@MainActor static let cleanDateUserDataID: String
-
The ID for the “Selected Tab” activity data field.
Declaration
Swift
@MainActor static let selectedTabUserDataID: String
-
Easy access to our navigation controller.
Declaration
Swift
@MainActor private var _navigationController: UINavigationController? { get }
-
This is the initial view controller.
Declaration
Swift
@MainActor private var _initialViewController: NACCInitialViewController? { get }
-
Quick accessor for the app delegate, cast to this class. READ-ONLY.
Declaration
Swift
@MainActor class var appDelegateInstance: NACCAppSceneDelegate? { get }
-
This will contain the date for the selectors.
Declaration
Swift
@MainActor var date: Date? { get set }
-
This will contain the textual report, for the calculation.
Declaration
Swift
@MainActor var report: String { get set }
-
This clears the original prefs, and prevents the reset on close.
Declaration
Swift
@MainActor func clearOriginalPrefs()
-
This will open and set up the app, in response to 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]]
The Universal Link Scheme is:
https://nacc.littlegreenviper.com/_[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
@MainActor func resolveURL(_ inURL: URL)
Parameters
inURL
The URL to be parsed.
-
This opens the app, and sets it to the given cleandate.
Declaration
Swift
@MainActor func open(to inCleanDate: DateComponents, with inTabIndex: NACCTabBarController.TabIndexes = .undefined)
Parameters
to
The cleadate, as date components.
with
The tab index. Optional. Default is the initial screen.
-
Called when the application starts.
Declaration
Swift
@MainActor func application(_: UIApplication, didFinishLaunchingWithOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool
Return Value
true, always.
-
Called when the scene connects. Returns the configuration to use for the scene.
Declaration
Swift
@MainActor func application(_: UIApplication, configurationForConnecting inConnectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration
Parameters
configurationForConnecting
The scene session that needs the configuration.
options
The scene configuration options (also ignored)
Return Value
The scene configuration.
-
Called when we receive a user activity.
Declaration
Swift
@MainActor func application(_ application: UIApplication, continue inUserActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool
Parameters
continue
The activity.
restorationHandler
A completion handler (also ignored)
Return Value
True, if it was handled.
-
Called when the app is foregrounded via a URL.
Declaration
Swift
@MainActor func scene(_: UIScene, openURLContexts inURLContexts: Set<UIOpenURLContext>)
Parameters
openURLContexts
The Opening URL contexts (as a set).
-
Called when the app is opened via a URL from a “cold start.”
Declaration
Swift
@MainActor func scene(_ inScene: UIScene, willConnectTo: UISceneSession, options inConnectionOptions: UIScene.ConnectionOptions)
Parameters
willConnectTo
The session being connected (ignored).
options
This contains the options, among which, is the URL context.
-
Called when the app is opened via a URL (and launched).
Declaration
Swift
@MainActor func scene(_: UIScene, continue inUserActivity: NSUserActivity)
Parameters
continue
The activity being continued.
-
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
@MainActor 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
@MainActor 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
@MainActor func sceneDidEnterBackground(_: UIScene)