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

Made sure multi-platform project compiles #196

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 14 additions & 12 deletions Sources/KeyboardShortcuts/Utilities.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import SwiftUI

#if os(macOS)
import Carbon.HIToolbox
import SwiftUI


extension String {
Expand Down Expand Up @@ -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 {
/**
Expand Down Expand Up @@ -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 {
Expand Down
Loading