From f13b9f117be9c7d75a05f059a4108d86108f5a60 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 20 Nov 2020 22:33:42 -0800 Subject: [PATCH] Update to Swift 5 --- ModMove.xcodeproj/project.pbxproj | 7 ++++--- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ ModMove/AccessibilityElement.swift | 10 +++++----- 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 ModMove.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ModMove.xcodeproj/project.pbxproj b/ModMove.xcodeproj/project.pbxproj index 3fd804f..520726c 100644 --- a/ModMove.xcodeproj/project.pbxproj +++ b/ModMove.xcodeproj/project.pbxproj @@ -126,7 +126,7 @@ TargetAttributes = { C27E73161BD9FFB00058FDD0 = { CreatedOnToolsVersion = 7.1; - LastSwiftMigration = 0920; + LastSwiftMigration = 1220; }; }; }; @@ -135,6 +135,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -275,7 +276,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "ModMove/Resources/ModMove-Bridging-Header.h"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -290,7 +291,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "ModMove/Resources/ModMove-Bridging-Header.h"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/ModMove.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ModMove.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ModMove.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ModMove/AccessibilityElement.swift b/ModMove/AccessibilityElement.swift index 8015055..555e945 100644 --- a/ModMove/AccessibilityElement.swift +++ b/ModMove/AccessibilityElement.swift @@ -68,7 +68,7 @@ final class AccessibilityElement { } AXUIElementSetAttributeValue(self.elementRef, - NSAccessibilityAttributeName.main.rawValue as CFString, + NSAccessibility.Attribute.main.rawValue as CFString, true as CFTypeRef) } @@ -98,13 +98,13 @@ final class AccessibilityElement { } } - private func rawValue(for attribute: NSAccessibilityAttributeName) -> AnyObject? { + private func rawValue(for attribute: NSAccessibility.Attribute) -> AnyObject? { var rawValue: AnyObject? let error = AXUIElementCopyAttributeValue(self.elementRef, attribute.rawValue as CFString, &rawValue) return error == .success ? rawValue : nil } - private func value(for attribute: NSAccessibilityAttributeName) -> Self? { + private func value(for attribute: NSAccessibility.Attribute) -> Self? { if let rawValue = self.rawValue(for: attribute), CFGetTypeID(rawValue) == AXUIElementGetTypeID() { return type(of: self).init(elementRef: rawValue as! AXUIElement) } @@ -112,11 +112,11 @@ final class AccessibilityElement { return nil } - private func value(for attribute: NSAccessibilityAttributeName) -> String? { + private func value(for attribute: NSAccessibility.Attribute) -> String? { return self.rawValue(for: attribute) as? String } - private func value(for attribute: NSAccessibilityAttributeName) -> T? { + private func value(for attribute: NSAccessibility.Attribute) -> T? { if let rawValue = self.rawValue(for: attribute), CFGetTypeID(rawValue) == AXValueGetTypeID() { return (rawValue as! AXValue).toValue() }