make AppDelegate a bit swifty

This commit is contained in:
Jesús A. Álvarez 2024-02-10 13:36:20 +01:00
parent 3b96faf502
commit 22256824d2
4 changed files with 7 additions and 7 deletions

View File

@ -23,8 +23,8 @@ extern NSString *DocumentsChangedNotification;
@property (readonly, nonatomic, getter = isSandboxed) BOOL sandboxed;
@property (readonly, nonatomic) id<Emulator> sharedEmulator;
+ (instancetype)sharedInstance;
+ (id<Emulator>)sharedEmulator;
@property (class, readonly, strong) AppDelegate *sharedInstance NS_SWIFT_NAME(shared);
@property (class, readonly, strong) id<Emulator> sharedEmulator NS_SWIFT_NAME(emulator);
- (void)loadAndStartEmulator;
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message;

View File

@ -15,7 +15,7 @@ class DefaultSceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = scene as? UIWindowScene else {
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")
}

View File

@ -15,7 +15,7 @@ class KeyboardSceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = scene as? UIWindowScene else {
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")
}

View File

@ -21,13 +21,13 @@ extension ViewController {
Spacer(minLength: 80.0)
HStack {
Button(action: {
AppDelegate.sharedInstance().showSettings(self)
AppDelegate.shared.showSettings(self)
}, label: {
Image(systemName: "gear")
}).glassBackgroundEffect()
Button(action: {
AppDelegate.sharedInstance().showInsertDisk(self)
AppDelegate.shared.showInsertDisk(self)
}, label: {
Image(systemName: "opticaldiscdrive")
}).glassBackgroundEffect()
@ -46,7 +46,7 @@ extension ViewController {
@objc
static func adjustToScreenSize() {
let screenSize = AppDelegate.sharedEmulator().screenSize
let screenSize = AppDelegate.emulator.screenSize
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
return
}