mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 11:43:24 +01:00
Fixes “stored properties cannot be marked @available” compiler error
Xcode 13 and earlier allowed us to mark lazy stored properties with @available, but it turns out this was never actually supported. Xcode 14 now throws a compiler error, so we work around it by converting lazy @available properties into computed properties, backed by typed-erased lazy ivars.
This commit is contained in:
@@ -34,10 +34,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
|
||||||
@available(iOS 14, *)
|
@available(iOS 14, *)
|
||||||
private lazy var intentHandler = IntentHandler()
|
private var intentHandler: IntentHandler {
|
||||||
|
get { _intentHandler as! IntentHandler }
|
||||||
|
set { _intentHandler = newValue }
|
||||||
|
}
|
||||||
|
|
||||||
@available(iOS 14, *)
|
@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
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ class AppManager
|
|||||||
{
|
{
|
||||||
static let shared = AppManager()
|
static let shared = AppManager()
|
||||||
|
|
||||||
@available(iOS 13, *)
|
|
||||||
private(set) lazy var publisher: AppManagerPublisher = AppManagerPublisher()
|
|
||||||
|
|
||||||
private(set) var updatePatronsResult: Result<Void, Error>?
|
private(set) var updatePatronsResult: Result<Void, Error>?
|
||||||
|
|
||||||
private let operationQueue = OperationQueue()
|
private let operationQueue = OperationQueue()
|
||||||
@@ -67,8 +64,27 @@ class AppManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS 13.0, *)
|
@available(iOS 13, *)
|
||||||
private lazy var cancellables = Set<AnyCancellable>()
|
private(set) var publisher: AppManagerPublisher {
|
||||||
|
get { _publisher as! AppManagerPublisher }
|
||||||
|
set { _publisher = newValue }
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 13, *)
|
||||||
|
private(set) var cancellables: Set<AnyCancellable> {
|
||||||
|
get { _cancellables as! Set<AnyCancellable> }
|
||||||
|
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<AnyCancellable>()
|
||||||
|
}()
|
||||||
|
|
||||||
private init()
|
private init()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user