mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 00:58:37 +00:00
update swift to 5.0
This commit is contained in:
parent
92975cb8e4
commit
e68fa10c42
@ -362,7 +362,7 @@
|
||||
TargetAttributes = {
|
||||
B082B24E205C7D8000BC04DC = {
|
||||
CreatedOnToolsVersion = 9.2;
|
||||
LastSwiftMigration = 1000;
|
||||
LastSwiftMigration = 1020;
|
||||
ProvisioningStyle = Manual;
|
||||
SystemCapabilities = {
|
||||
com.apple.Sandbox = {
|
||||
@ -372,7 +372,7 @@
|
||||
};
|
||||
B082B260205C7D8000BC04DC = {
|
||||
CreatedOnToolsVersion = 9.2;
|
||||
LastSwiftMigration = 1000;
|
||||
LastSwiftMigration = 1020;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -640,7 +640,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "MTMR/CBridge/TouchBarPrivateApi-Bridging.h";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -663,7 +663,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "MTMR/CBridge/TouchBarPrivateApi-Bridging.h";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -676,7 +676,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = Toxblh.MTMRTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -691,7 +691,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = Toxblh.MTMRTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@ -56,7 +56,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
|
||||
if frontmostApplicationIdentifier != nil {
|
||||
isBlockedApp = blacklistAppIdentifiers.index(of: frontmostApplicationIdentifier!) != nil
|
||||
isBlockedApp = blacklistAppIdentifiers.firstIndex(of: frontmostApplicationIdentifier!) != nil
|
||||
} else {
|
||||
isBlockedApp = false
|
||||
}
|
||||
@ -81,7 +81,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
@objc func toggleBlackListedApp(_: Any?) {
|
||||
let appIdentifier = TouchBarController.shared.frontmostApplicationIdentifier
|
||||
if appIdentifier != nil {
|
||||
if let index = TouchBarController.shared.blacklistAppIdentifiers.index(of: appIdentifier!) {
|
||||
if let index = TouchBarController.shared.blacklistAppIdentifiers.firstIndex(of: appIdentifier!) {
|
||||
TouchBarController.shared.blacklistAppIdentifiers.remove(at: index)
|
||||
} else {
|
||||
TouchBarController.shared.blacklistAppIdentifiers.append(appIdentifier!)
|
||||
|
||||
@ -161,7 +161,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
|
||||
}
|
||||
|
||||
func updateActiveApp() {
|
||||
if frontmostApplicationIdentifier != nil && blacklistAppIdentifiers.index(of: frontmostApplicationIdentifier!) != nil {
|
||||
if frontmostApplicationIdentifier != nil && blacklistAppIdentifiers.firstIndex(of: frontmostApplicationIdentifier!) != nil {
|
||||
dismissTouchBar()
|
||||
} else {
|
||||
presentTouchBar()
|
||||
|
||||
@ -80,7 +80,7 @@ class AppScrubberTouchBarItem: NSCustomTouchBarItem, NSScrubberDelegate, NSScrub
|
||||
func updateRunningApplication() {
|
||||
let newApplications = launchedApplications()
|
||||
|
||||
let index = newApplications.index {
|
||||
let index = newApplications.firstIndex {
|
||||
$0.bundleIdentifier == frontmostApplicationIdentifier
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class AppScrubberTouchBarItem: NSCustomTouchBarItem, NSScrubberDelegate, NSScrub
|
||||
}
|
||||
} else {
|
||||
HapticFeedback.shared?.tap(strong: 6)
|
||||
if let index = self.persistentAppIdentifiers.index(of: bundleIdentifier!) {
|
||||
if let index = self.persistentAppIdentifiers.firstIndex(of: bundleIdentifier!) {
|
||||
persistentAppIdentifiers.remove(at: index)
|
||||
} else {
|
||||
persistentAppIdentifiers.append(bundleIdentifier!)
|
||||
|
||||
@ -31,7 +31,7 @@ class NetworkBarItem: CustomButtonTouchBarItem, Widget {
|
||||
var dSpeed: UInt64?
|
||||
var uSpeed: UInt64?
|
||||
var curr: Array<Substring>?
|
||||
var dataAvailable: NSObjectProtocol!
|
||||
var dataAvailable: NSObjectProtocol?
|
||||
|
||||
pipe = Pipe()
|
||||
bandwidthProcess = Process()
|
||||
@ -64,19 +64,21 @@ class NetworkBarItem: CustomButtonTouchBarItem, Widget {
|
||||
}
|
||||
}
|
||||
outputHandle.waitForDataInBackgroundAndNotify()
|
||||
} else {
|
||||
} else if let dataAvailable = dataAvailable {
|
||||
NotificationCenter.default.removeObserver(dataAvailable)
|
||||
}
|
||||
}
|
||||
|
||||
var dataReady: NSObjectProtocol!
|
||||
var dataReady: NSObjectProtocol?
|
||||
dataReady = NotificationCenter.default.addObserver(
|
||||
forName: Process.didTerminateNotification,
|
||||
object: outputHandle,
|
||||
queue: nil
|
||||
) { _ -> Void in
|
||||
print("Task terminated!")
|
||||
NotificationCenter.default.removeObserver(dataReady)
|
||||
if let observer = dataReady {
|
||||
NotificationCenter.default.removeObserver(observer)
|
||||
}
|
||||
}
|
||||
|
||||
bandwidthProcess?.launch()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user