Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sauce.framework v2.2.0 #74

Merged
merged 1 commit into from
Apr 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "Clipy/Sauce" "v2.1.0"
github "Clipy/Sauce" "v2.2.0"
2 changes: 1 addition & 1 deletion Lib/Magnet/Extensions/NSEventExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ extension NSEvent {
/// Returns a matching `KeyCombo` for the event, if the event is a keyboard event and the key is recognized.
public var keyCombo: KeyCombo? {
guard self.type.isKeyboardEvent else { return nil }
guard let key = Sauce.shared.key(by: Int(self.keyCode)) else { return nil }
guard let key = Sauce.shared.key(for: Int(self.keyCode)) else { return nil }
return KeyCombo(key: key, cocoaModifiers: self.modifierFlags)
}
}
10 changes: 5 additions & 5 deletions Lib/Magnet/KeyCombo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ public final class KeyCombo: NSObject, NSCopying, NSCoding, Codable {
}
public var characters: String {
guard !doubledModifiers else { return "" }
return Sauce.shared.character(by: Int(Sauce.shared.keyCode(by: key)), carbonModifiers: modifiers) ?? ""
return Sauce.shared.character(for: Int(Sauce.shared.keyCode(for: key)), carbonModifiers: modifiers) ?? ""
}
public var keyEquivalent: String {
guard !doubledModifiers else { return "" }
let keyCode = Int(Sauce.shared.keyCode(by: key))
guard key.isAlphabet else { return Sauce.shared.character(by: keyCode, cocoaModifiers: []) ?? "" }
let keyCode = Int(Sauce.shared.keyCode(for: key))
guard key.isAlphabet else { return Sauce.shared.character(for: keyCode, cocoaModifiers: []) ?? "" }
let modifiers = keyEquivalentModifierMask.filterNotShiftModifiers()
return Sauce.shared.character(by: keyCode, cocoaModifiers: modifiers) ?? ""
return Sauce.shared.character(for: keyCode, cocoaModifiers: modifiers) ?? ""
}
public var keyEquivalentModifierMask: NSEvent.ModifierFlags {
return NSEvent.ModifierFlags(carbonModifiers: self.modifiers)
Expand All @@ -41,7 +41,7 @@ public final class KeyCombo: NSObject, NSCopying, NSCoding, Codable {
}
public var currentKeyCode: CGKeyCode {
guard !doubledModifiers else { return 0 }
return Sauce.shared.keyCode(by: key)
return Sauce.shared.keyCode(for: key)
}

// MARK: - Initialize
Expand Down
2 changes: 1 addition & 1 deletion Magnet.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Pod::Spec.new do |s|
s.source_files = 'Lib/Magnet/**/*.swift'
s.swift_version = '5.0'
s.frameworks = 'Carbon', 'Cocoa'
s.dependency 'Sauce', '~> 2.1'
s.dependency 'Sauce', '~> 2.2'
end
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
targets: ["Magnet"]),
],
dependencies: [
.package(url: "https://github.com/Clipy/Sauce", from: "2.1.0"),
.package(url: "https://github.com/Clipy/Sauce", from: "2.2.0"),
],
targets: [
.target(
Expand Down