make AppDelegate a bit swifty
This commit is contained in:
parent
3b96faf502
commit
22256824d2
|
@ -23,8 +23,8 @@ extern NSString *DocumentsChangedNotification;
|
||||||
@property (readonly, nonatomic, getter = isSandboxed) BOOL sandboxed;
|
@property (readonly, nonatomic, getter = isSandboxed) BOOL sandboxed;
|
||||||
@property (readonly, nonatomic) id<Emulator> sharedEmulator;
|
@property (readonly, nonatomic) id<Emulator> sharedEmulator;
|
||||||
|
|
||||||
+ (instancetype)sharedInstance;
|
@property (class, readonly, strong) AppDelegate *sharedInstance NS_SWIFT_NAME(shared);
|
||||||
+ (id<Emulator>)sharedEmulator;
|
@property (class, readonly, strong) id<Emulator> sharedEmulator NS_SWIFT_NAME(emulator);
|
||||||
- (void)loadAndStartEmulator;
|
- (void)loadAndStartEmulator;
|
||||||
|
|
||||||
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message;
|
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message;
|
||||||
|
|
|
@ -15,7 +15,7 @@ class DefaultSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
guard let windowScene = scene as? UIWindowScene else {
|
guard let windowScene = scene as? UIWindowScene else {
|
||||||
fatalError("Expected scene of type UIWindowScene but got an unexpected type")
|
fatalError("Expected scene of type UIWindowScene but got an unexpected type")
|
||||||
}
|
}
|
||||||
guard let appDelegate = AppDelegate.sharedInstance() else {
|
guard let appDelegate = AppDelegate.shared else {
|
||||||
fatalError("No app delegate")
|
fatalError("No app delegate")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class KeyboardSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
guard let windowScene = scene as? UIWindowScene else {
|
guard let windowScene = scene as? UIWindowScene else {
|
||||||
fatalError("Expected scene of type UIWindowScene but got an unexpected type")
|
fatalError("Expected scene of type UIWindowScene but got an unexpected type")
|
||||||
}
|
}
|
||||||
guard let mainViewController = AppDelegate.sharedInstance().window.rootViewController as? ViewController else {
|
guard let mainViewController = AppDelegate.shared.window.rootViewController as? ViewController else {
|
||||||
fatalError("No main view controller")
|
fatalError("No main view controller")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,13 @@ extension ViewController {
|
||||||
Spacer(minLength: 80.0)
|
Spacer(minLength: 80.0)
|
||||||
HStack {
|
HStack {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
AppDelegate.sharedInstance().showSettings(self)
|
AppDelegate.shared.showSettings(self)
|
||||||
}, label: {
|
}, label: {
|
||||||
Image(systemName: "gear")
|
Image(systemName: "gear")
|
||||||
}).glassBackgroundEffect()
|
}).glassBackgroundEffect()
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
AppDelegate.sharedInstance().showInsertDisk(self)
|
AppDelegate.shared.showInsertDisk(self)
|
||||||
}, label: {
|
}, label: {
|
||||||
Image(systemName: "opticaldiscdrive")
|
Image(systemName: "opticaldiscdrive")
|
||||||
}).glassBackgroundEffect()
|
}).glassBackgroundEffect()
|
||||||
|
@ -46,7 +46,7 @@ extension ViewController {
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
static func adjustToScreenSize() {
|
static func adjustToScreenSize() {
|
||||||
let screenSize = AppDelegate.sharedEmulator().screenSize
|
let screenSize = AppDelegate.emulator.screenSize
|
||||||
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
|
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue