Upgrade to Swift 4.2

This commit is contained in:
Sindre Sorhus 2018-09-14 17:13:01 +07:00
parent 81cac0e617
commit c4ccc52bb8
3 changed files with 14 additions and 14 deletions

View file

@ -346,7 +346,7 @@
E3FE2CBE1E726CE800C6713A = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = YG56YK5RN5;
LastSwiftMigration = 0900;
LastSwiftMigration = "";
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.HardenedRuntime = {
@ -539,8 +539,7 @@
SWIFT_COMPILATION_MODE = singlefile;
SWIFT_OBJC_BRIDGING_HEADER = "Touch Bar Simulator/Touch Bar Simulator-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VALID_ARCHS = x86_64;
};
name = Debug;
@ -573,8 +572,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
REEXPORTED_LIBRARY_PATHS = "";
SWIFT_OBJC_BRIDGING_HEADER = "Touch Bar Simulator/Touch Bar Simulator-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VALID_ARCHS = x86_64;
};
name = Release;

View file

@ -3,7 +3,7 @@ import Sparkle
private let defaults = UserDefaults.standard
final class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
final class AppDelegate: NSObject, NSApplicationDelegate {
let controller = IDETouchBarSimulatorHostWindowController.simulatorHostWindowController()!
lazy var window: NSWindow = self.controller.window!
lazy var toolbarView: NSView = self.window.toolbarView!
@ -17,7 +17,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
NSApp.servicesProvider = self
window.delegate = self
window.alphaValue = CGFloat(defaults.double(forKey: "windowTransparency"))
_ = SUUpdater()
@ -27,10 +29,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
)
}
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
func makeScreenshotButton() -> NSButton {
let button = NSButton()
button.image = #imageLiteral(resourceName: "ScreenshotButton")
@ -43,13 +41,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
}
func makeTransparencySlider() -> ToolbarSlider {
let transparency = defaults.double(forKey: "windowTransparency")
let slider = ToolbarSlider()
slider.frame = CGRect(x: toolbarView.frame.width - 150, y: 4, width: 120, height: 11)
slider.action = #selector(setTransparency)
slider.minValue = 0.5
slider.doubleValue = transparency
window.alphaValue = CGFloat(transparency)
slider.doubleValue = defaults.double(forKey: "windowTransparency")
return slider
}
@ -70,3 +66,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
window.setIsVisible(!window.isVisible)
}
}
extension AppDelegate: NSWindowDelegate {
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}

View file

@ -30,7 +30,7 @@ $ brew update && brew cask install touch-bar-simulator
```
*Requires macOS 10.13 or later.*
*Requires macOS 10.14 or later.*
## Screenshot