diff --git a/AltStore/AppDelegate.swift b/AltStore/AppDelegate.swift index 49be4e2a..dbbf160f 100644 --- a/AltStore/AppDelegate.swift +++ b/AltStore/AppDelegate.swift @@ -34,11 +34,27 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? @available(iOS 14, *) - private lazy var intentHandler = IntentHandler() + private var intentHandler: IntentHandler { + get { _intentHandler as! IntentHandler } + set { _intentHandler = newValue } + } @available(iOS 14, *) - private lazy var viewAppIntentHandler = ViewAppIntentHandler() - + private var viewAppIntentHandler: ViewAppIntentHandler { + get { _viewAppIntentHandler as! ViewAppIntentHandler } + set { _viewAppIntentHandler = newValue } + } + + private lazy var _intentHandler: Any = { + guard #available(iOS 14, *) else { fatalError() } + return IntentHandler() + }() + + private lazy var _viewAppIntentHandler: Any = { + guard #available(iOS 14, *) else { fatalError() } + return ViewAppIntentHandler() + }() + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Register default settings before doing anything else. diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index f9ddba2d..a440824a 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -46,9 +46,6 @@ class AppManager { static let shared = AppManager() - @available(iOS 13, *) - private(set) lazy var publisher: AppManagerPublisher = AppManagerPublisher() - private(set) var updatePatronsResult: Result? private let operationQueue = OperationQueue() @@ -67,8 +64,27 @@ class AppManager } } - @available(iOS 13.0, *) - private lazy var cancellables = Set() + @available(iOS 13, *) + private(set) var publisher: AppManagerPublisher { + get { _publisher as! AppManagerPublisher } + set { _publisher = newValue } + } + + @available(iOS 13, *) + private(set) var cancellables: Set { + get { _cancellables as! Set } + set { _cancellables = newValue } + } + + private lazy var _publisher: Any = { + guard #available(iOS 13, *) else { fatalError() } + return AppManagerPublisher() + }() + + private lazy var _cancellables: Any = { + guard #available(iOS 13, *) else { fatalError() } + return Set() + }() private init() {