Skip to content

Commit

Permalink
Merge pull request #1 from keith/ks/update-to-swift-5
Browse files Browse the repository at this point in the history
Update to Swift 5
  • Loading branch information
keith authored Nov 21, 2020
2 parents c5d7bf3 + f13b9f1 commit fc1a01c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
7 changes: 4 additions & 3 deletions ModMove.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
TargetAttributes = {
C27E73161BD9FFB00058FDD0 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0920;
LastSwiftMigration = 1220;
};
};
};
Expand All @@ -135,6 +135,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -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;
};
Expand All @@ -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;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
10 changes: 5 additions & 5 deletions ModMove/AccessibilityElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final class AccessibilityElement {
}

AXUIElementSetAttributeValue(self.elementRef,
NSAccessibilityAttributeName.main.rawValue as CFString,
NSAccessibility.Attribute.main.rawValue as CFString,
true as CFTypeRef)
}

Expand Down Expand Up @@ -98,25 +98,25 @@ 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)
}

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<T>(for attribute: NSAccessibilityAttributeName) -> T? {
private func value<T>(for attribute: NSAccessibility.Attribute) -> T? {
if let rawValue = self.rawValue(for: attribute), CFGetTypeID(rawValue) == AXValueGetTypeID() {
return (rawValue as! AXValue).toValue()
}
Expand Down

0 comments on commit fc1a01c

Please sign in to comment.