diff --git a/Sources/KeyboardShortcuts/Utilities.swift b/Sources/KeyboardShortcuts/Utilities.swift index cd2a8f6..defa072 100644 --- a/Sources/KeyboardShortcuts/Utilities.swift +++ b/Sources/KeyboardShortcuts/Utilities.swift @@ -1,6 +1,7 @@ +import SwiftUI + #if os(macOS) import Carbon.HIToolbox -import SwiftUI extension String { @@ -509,6 +510,18 @@ extension Dictionary { } #endif +@available(iOS 14.0, *) +@available(macOS 11.0, *) +extension KeyEquivalent { + init?(unicodeScalarValue value: Int) { + guard let character = Character(unicodeScalarValue: value) else { + return nil + } + + self = KeyEquivalent(character) + } +} + extension Sequence where Element: Hashable { /** @@ -536,17 +549,6 @@ extension StringProtocol { } } -@available(macOS 11.0, *) -extension KeyEquivalent { - init?(unicodeScalarValue value: Int) { - guard let character = Character(unicodeScalarValue: value) else { - return nil - } - - self = KeyEquivalent(character) - } -} - extension Character { init?(unicodeScalarValue value: Int) { guard let content = UnicodeScalar(value) else {