diff --git a/MySensors.xcodeproj/project.pbxproj b/MySensors.xcodeproj/project.pbxproj index 4136a1e..cd63eca 100644 --- a/MySensors.xcodeproj/project.pbxproj +++ b/MySensors.xcodeproj/project.pbxproj @@ -93,6 +93,7 @@ TargetAttributes = { 479D566E1D97A76D00713B6E = { CreatedOnToolsVersion = 8.0; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; }; @@ -250,7 +251,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = me.aisk.MySensors; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -263,7 +265,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = me.aisk.MySensors; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/MySensors/AppDelegate.swift b/MySensors/AppDelegate.swift index 0646670..1309e32 100644 --- a/MySensors/AppDelegate.swift +++ b/MySensors/AppDelegate.swift @@ -21,10 +21,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate { let alert = NSAlert() alert.messageText = "initailize SMC failed!" alert.runModal() - NSApplication.shared().terminate(self) + NSApplication.shared.terminate(self) } - statusItem = NSStatusBar.system().statusItem(withLength: NSSquareStatusItemLength) + statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength) let icon = NSImage(named: "ic_memory") icon?.isTemplate = true statusItem.image = icon @@ -36,8 +36,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate { let _ = SMCKit.close() } - func onQuitMenuItemClicked(_ sender: NSMenuItem) { - NSApplication.shared().terminate(self) + @objc func onQuitMenuItemClicked(_ sender: NSMenuItem) { + NSApplication.shared.terminate(self) } func menuWillOpen(_ menu: NSMenu) {