Update MSC.app to Swift 5 syntax (minor changes)

This commit is contained in:
Greg Neagle
2020-06-10 20:17:55 -07:00
parent f959efa85a
commit 5e5dd67126
5 changed files with 7 additions and 6 deletions
@@ -324,6 +324,7 @@
};
C04F827A20BB319B00F9C57D = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1150;
ProvisioningStyle = Manual;
SystemCapabilities = {
com.apple.Sandbox = {
@@ -708,7 +709,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.googlecode.munki.ManagedSoftwareCenter;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -727,7 +728,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.googlecode.munki.ManagedSoftwareCenter;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -189,7 +189,7 @@ class MSCAlertController: NSObject {
timers.append(timer3)
// wait 10 seconds, then quit
let timer4 = Timer.scheduledTimer(timeInterval: 10.0,
target: NSApp,
target: NSApp as Any,
selector: #selector(NSApp.terminate),
userInfo: self,
repeats: false)
@@ -97,7 +97,7 @@ class MSCPasswordAlertController: NSObject {
shakeAnimation.path = shakePath
shakeAnimation.duration = durationOfShake
let frameOriginKey = NSAnimatablePropertyKey(rawValue: "frameOrigin")
let frameOriginKey = "frameOrigin"
the_window.animations = [frameOriginKey: shakeAnimation]
the_window.animator().setFrameOrigin(frame.origin)
}
@@ -760,7 +760,7 @@ class MainWindowController: NSWindowController, NSWindowDelegate, WKNavigationDe
// Display the update count as a badge in the window toolbar
// and as an icon badge in the Dock
let updateCount = getUpdateCount()
let btn_image = MSCBadgedTemplateImage.image(named: NSImage.Name(rawValue: "updatesTemplate.pdf"),
let btn_image = MSCBadgedTemplateImage.image(named: "updatesTemplate.pdf",
withCount: updateCount)
updateButtonCell.image = btn_image
if updateCount > 0 {
@@ -32,7 +32,7 @@ class MSCBadgedTemplateImage: NSImage {
traits: .boldFontMask,
weight: 0,
size: badgeFontSize)
let stringAttributes = [ NSAttributedStringKey.font: badgeFont as Any ]
let stringAttributes = [ NSAttributedString.Key.font: badgeFont as Any ]
let textSize = badgeString.size(withAttributes: stringAttributes)
// use textSize as the basis for the badge outline rect