From 52fffc9d5181b6e3f8cfeb9ca6281138ae931e8d Mon Sep 17 00:00:00 2001 From: Jordan Baird <jordanbaird.dev@gmail.com> Date: Wed, 16 Aug 2023 15:35:21 -0600 Subject: [PATCH] Make `isReservedBySystem(key:modifiers:)` public --- Sources/SwiftKeys/KeyCommand/KeyCommand.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftKeys/KeyCommand/KeyCommand.swift b/Sources/SwiftKeys/KeyCommand/KeyCommand.swift index 602f40c..c57346a 100644 --- a/Sources/SwiftKeys/KeyCommand/KeyCommand.swift +++ b/Sources/SwiftKeys/KeyCommand/KeyCommand.swift @@ -145,7 +145,19 @@ public struct KeyCommand { // MARK: Static Methods - static func isReservedBySystem(key: Key, modifiers: [Modifier]) -> Bool { + /// Returns a Boolean value that indicates whether the given key-modifier + /// combination is reserved for system use. + /// + /// This can be useful when you need to determine if a key-modifier combination + /// is available for use as a key command before actually creating the command. + /// + /// - Parameters: + /// - key: The key to look for in the system. + /// - modifiers: The modifiers to look for in the system. + /// + /// - Returns: `true` if the system reserves the given key-modifier combination + /// for its own use. `false` otherwise. + public static func isReservedBySystem(key: Key, modifiers: [Modifier]) -> Bool { reservedHotKeys.contains { hotKey in guard hotKey[kHISymbolicHotKeyEnabled] as? Bool == true,