From c5d135bf82e47e4385540a2ea3e7b1079a37064a Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Tue, 23 Mar 2021 12:47:46 +0700 Subject: [PATCH] Drop support for CocoaPods and Carthage --- .github/funding.yml | 3 - .github/workflows/swiftlint.yml | 2 +- .swiftlint.yml | 10 +- .../project.pbxproj | 370 +++++++ Example/KeyboardShortcutsExample/App.swift | 17 + .../KeyboardShortcutsExample/AppState.swift | 38 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/Contents.json | 0 .../ContentView.swift | 1 + .../KeyboardShortcutsExample}/Info.plist | 6 +- .../KeyboardShortcutsExample.entitlements | 2 - .../Preview Assets.xcassets/Contents.json | 6 + .../KeyboardShortcutsExample/Utilities.swift | 109 +++ KeyboardShortcuts.podspec | 14 - .../KeyboardShortcuts_Info.plist | 26 - KeyboardShortcuts.xcodeproj/project.pbxproj | 903 ------------------ .../KeyboardShortcuts-Package.xcscheme | 58 -- .../xcschemes/KeyboardShortcuts.xcscheme | 67 -- .../KeyboardShortcutsExample.xcscheme | 78 -- .../xcschemes/KeyboardShortcutsTests.xcscheme | 52 - KeyboardShortcutsExample/AppDelegate.swift | 93 -- .../Base.lproj/Main.storyboard | 337 ------- KeyboardShortcutsExample/Info.plist | 32 - Package.swift | 6 + Sources/KeyboardShortcuts/Key.swift | 2 + .../{util.swift => Utilities.swift} | 0 .../KeyboardShortcutsTests.swift | 0 .../KeyboardShortcutsTests}/Utilities.swift | 0 readme.md | 22 +- 30 files changed, 578 insertions(+), 1687 deletions(-) delete mode 100644 .github/funding.yml create mode 100644 Example/KeyboardShortcutsExample.xcodeproj/project.pbxproj create mode 100644 Example/KeyboardShortcutsExample/App.swift create mode 100644 Example/KeyboardShortcutsExample/AppState.swift create mode 100644 Example/KeyboardShortcutsExample/Assets.xcassets/AccentColor.colorset/Contents.json rename {KeyboardShortcutsExample => Example/KeyboardShortcutsExample}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {KeyboardShortcutsExample => Example/KeyboardShortcutsExample}/Assets.xcassets/Contents.json (100%) rename {KeyboardShortcutsExample => Example/KeyboardShortcutsExample}/ContentView.swift (98%) rename {KeyboardShortcutsTests => Example/KeyboardShortcutsExample}/Info.plist (80%) rename {KeyboardShortcutsExample => Example/KeyboardShortcutsExample}/KeyboardShortcutsExample.entitlements (77%) create mode 100644 Example/KeyboardShortcutsExample/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 Example/KeyboardShortcutsExample/Utilities.swift delete mode 100644 KeyboardShortcuts.podspec delete mode 100644 KeyboardShortcuts.xcodeproj/KeyboardShortcuts_Info.plist delete mode 100644 KeyboardShortcuts.xcodeproj/project.pbxproj delete mode 100644 KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcuts-Package.xcscheme delete mode 100644 KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcuts.xcscheme delete mode 100644 KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcutsExample.xcscheme delete mode 100644 KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcutsTests.xcscheme delete mode 100644 KeyboardShortcutsExample/AppDelegate.swift delete mode 100644 KeyboardShortcutsExample/Base.lproj/Main.storyboard delete mode 100644 KeyboardShortcutsExample/Info.plist rename Sources/KeyboardShortcuts/{util.swift => Utilities.swift} (100%) rename {KeyboardShortcutsTests => Tests/KeyboardShortcutsTests}/KeyboardShortcutsTests.swift (100%) rename {KeyboardShortcutsTests => Tests/KeyboardShortcutsTests}/Utilities.swift (100%) diff --git a/.github/funding.yml b/.github/funding.yml deleted file mode 100644 index 1a630e93..00000000 --- a/.github/funding.yml +++ /dev/null @@ -1,3 +0,0 @@ -github: sindresorhus -open_collective: sindresorhus -custom: https://sindresorhus.com/donate diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml index bcf86b27..27653452 100644 --- a/.github/workflows/swiftlint.yml +++ b/.github/workflows/swiftlint.yml @@ -11,4 +11,4 @@ jobs: steps: - uses: actions/checkout@v2 - name: SwiftLint - uses: norio-nomura/action-swiftlint@3.1.0 + uses: norio-nomura/action-swiftlint@3.2.1 diff --git a/.swiftlint.yml b/.swiftlint.yml index ea634938..1ee99217 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -21,6 +21,7 @@ only_rules: - custom_rules - deployment_target - discarded_notification_center_observer + - discouraged_assert - discouraged_direct_init - discouraged_object_literal - discouraged_optional_boolean @@ -86,6 +87,7 @@ only_rules: - prefer_zero_over_explicit_init - private_action - private_outlet + - private_subject - private_unit_test - prohibited_super_call - protocol_property_accessors_order @@ -139,6 +141,7 @@ only_rules: - xctfail_message - yoda_condition analyzer_rules: + - capture_variable - unused_declaration - unused_import number_separator: @@ -178,8 +181,11 @@ custom_rules: match_kinds: typeidentifier message: 'Use CGPoint instead of NSPoint' swiftui_state_private: - regex: '@(State|StateObject)\s+var' - message: "SwiftUI @State/@StateObject properties should be private" + regex: '@(State|StateObject|ObservedObject|EnvironmentObject)\s+var' + message: "SwiftUI @State/@StateObject/@ObservedObject/@EnvironmentObject properties should be private" + swiftui_environment_private: + regex: '@Environment\(\\\.\w+\)\s+var' + message: "SwiftUI @Environment properties should be private" final_class: regex: '^class [a-zA-Z\d]+[^{]+\{' message: "Classes should be marked as final whenever possible. If you actually need it to be subclassable, just add `// swiftlint:disable:next final_class`." diff --git a/Example/KeyboardShortcutsExample.xcodeproj/project.pbxproj b/Example/KeyboardShortcutsExample.xcodeproj/project.pbxproj new file mode 100644 index 00000000..ad9c0728 --- /dev/null +++ b/Example/KeyboardShortcutsExample.xcodeproj/project.pbxproj @@ -0,0 +1,370 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + E36FB94A2609BA43004272D9 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = E36FB9492609BA43004272D9 /* App.swift */; }; + E36FB94C2609BA43004272D9 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E36FB94B2609BA43004272D9 /* ContentView.swift */; }; + E36FB94E2609BA45004272D9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E36FB94D2609BA45004272D9 /* Assets.xcassets */; }; + E36FB9512609BA45004272D9 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E36FB9502609BA45004272D9 /* Preview Assets.xcassets */; }; + E36FB9632609BB83004272D9 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = E36FB9622609BB83004272D9 /* AppState.swift */; }; + E36FB9662609BF3D004272D9 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = E36FB9652609BF3D004272D9 /* Utilities.swift */; }; + E386C4D32609C0C500F147B8 /* KeyboardShortcuts in Frameworks */ = {isa = PBXBuildFile; productRef = E386C4D22609C0C500F147B8 /* KeyboardShortcuts */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + E36FB9462609BA43004272D9 /* KeyboardShortcutsExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KeyboardShortcutsExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E36FB9492609BA43004272D9 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = ""; }; + E36FB94B2609BA43004272D9 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + E36FB94D2609BA45004272D9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + E36FB9502609BA45004272D9 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + E36FB9522609BA45004272D9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E36FB9532609BA45004272D9 /* KeyboardShortcutsExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = KeyboardShortcutsExample.entitlements; sourceTree = ""; }; + E36FB9622609BB83004272D9 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = ""; }; + E36FB9652609BF3D004272D9 /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = ""; }; + E386C4D02609C0B700F147B8 /* KeyboardShortcuts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = KeyboardShortcuts; path = ..; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E36FB9432609BA43004272D9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E386C4D32609C0C500F147B8 /* KeyboardShortcuts in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E36FB93D2609BA43004272D9 = { + isa = PBXGroup; + children = ( + E386C4D02609C0B700F147B8 /* KeyboardShortcuts */, + E36FB9482609BA43004272D9 /* KeyboardShortcutsExample */, + E36FB9472609BA43004272D9 /* Products */, + E36FB95E2609BACA004272D9 /* Frameworks */, + ); + sourceTree = ""; + }; + E36FB9472609BA43004272D9 /* Products */ = { + isa = PBXGroup; + children = ( + E36FB9462609BA43004272D9 /* KeyboardShortcutsExample.app */, + ); + name = Products; + sourceTree = ""; + }; + E36FB9482609BA43004272D9 /* KeyboardShortcutsExample */ = { + isa = PBXGroup; + children = ( + E36FB9492609BA43004272D9 /* App.swift */, + E36FB9622609BB83004272D9 /* AppState.swift */, + E36FB9652609BF3D004272D9 /* Utilities.swift */, + E36FB94B2609BA43004272D9 /* ContentView.swift */, + E36FB94D2609BA45004272D9 /* Assets.xcassets */, + E36FB9522609BA45004272D9 /* Info.plist */, + E36FB9532609BA45004272D9 /* KeyboardShortcutsExample.entitlements */, + E36FB94F2609BA45004272D9 /* Preview Content */, + ); + path = KeyboardShortcutsExample; + sourceTree = ""; + }; + E36FB94F2609BA45004272D9 /* Preview Content */ = { + isa = PBXGroup; + children = ( + E36FB9502609BA45004272D9 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + E36FB95E2609BACA004272D9 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + E36FB9452609BA43004272D9 /* KeyboardShortcutsExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = E36FB9562609BA45004272D9 /* Build configuration list for PBXNativeTarget "KeyboardShortcutsExample" */; + buildPhases = ( + E36FB9422609BA43004272D9 /* Sources */, + E36FB9432609BA43004272D9 /* Frameworks */, + E36FB9442609BA43004272D9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = KeyboardShortcutsExample; + packageProductDependencies = ( + E386C4D22609C0C500F147B8 /* KeyboardShortcuts */, + ); + productName = KeyboardShortcutsExample; + productReference = E36FB9462609BA43004272D9 /* KeyboardShortcutsExample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E36FB93E2609BA43004272D9 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1240; + LastUpgradeCheck = 1240; + TargetAttributes = { + E36FB9452609BA43004272D9 = { + CreatedOnToolsVersion = 12.4; + }; + }; + }; + buildConfigurationList = E36FB9412609BA43004272D9 /* Build configuration list for PBXProject "KeyboardShortcutsExample" */; + compatibilityVersion = "Xcode 12.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E36FB93D2609BA43004272D9; + productRefGroup = E36FB9472609BA43004272D9 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E36FB9452609BA43004272D9 /* KeyboardShortcutsExample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E36FB9442609BA43004272D9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E36FB9512609BA45004272D9 /* Preview Assets.xcassets in Resources */, + E36FB94E2609BA45004272D9 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E36FB9422609BA43004272D9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E36FB9632609BB83004272D9 /* AppState.swift in Sources */, + E36FB94C2609BA43004272D9 /* ContentView.swift in Sources */, + E36FB9662609BF3D004272D9 /* Utilities.swift in Sources */, + E36FB94A2609BA43004272D9 /* App.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + E36FB9542609BA45004272D9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 11.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + E36FB9552609BA45004272D9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 11.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + E36FB9572609BA45004272D9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"KeyboardShortcutsExample/Preview Content\""; + DEVELOPMENT_TEAM = ""; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = KeyboardShortcutsExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MARKETING_VERSION = 1.0.0; + PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.KeyboardShortcutsExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + E36FB9582609BA45004272D9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"KeyboardShortcutsExample/Preview Content\""; + DEVELOPMENT_TEAM = ""; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = KeyboardShortcutsExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MARKETING_VERSION = 1.0.0; + PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.KeyboardShortcutsExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E36FB9412609BA43004272D9 /* Build configuration list for PBXProject "KeyboardShortcutsExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E36FB9542609BA45004272D9 /* Debug */, + E36FB9552609BA45004272D9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E36FB9562609BA45004272D9 /* Build configuration list for PBXNativeTarget "KeyboardShortcutsExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E36FB9572609BA45004272D9 /* Debug */, + E36FB9582609BA45004272D9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + E386C4D22609C0C500F147B8 /* KeyboardShortcuts */ = { + isa = XCSwiftPackageProductDependency; + productName = KeyboardShortcuts; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = E36FB93E2609BA43004272D9 /* Project object */; +} diff --git a/Example/KeyboardShortcutsExample/App.swift b/Example/KeyboardShortcutsExample/App.swift new file mode 100644 index 00000000..c30b4350 --- /dev/null +++ b/Example/KeyboardShortcutsExample/App.swift @@ -0,0 +1,17 @@ +import SwiftUI + +@main +struct AppMain: App { + @StateObject private var state = AppState() + + var body: some Scene { + WindowGroup { + ContentView() + .onAppear { + DispatchQueue.main.async { + state.createMenus() + } + } + } + } +} diff --git a/Example/KeyboardShortcutsExample/AppState.swift b/Example/KeyboardShortcutsExample/AppState.swift new file mode 100644 index 00000000..bdcb422f --- /dev/null +++ b/Example/KeyboardShortcutsExample/AppState.swift @@ -0,0 +1,38 @@ +import SwiftUI + +final class AppState: ObservableObject { + func createMenus() { + let testMenuItem = NSMenuItem() + NSApp.mainMenu?.addItem(testMenuItem) + + let testMenu = NSMenu() + testMenu.title = "Test" + testMenuItem.submenu = testMenu + + testMenu.addCallbackItem("Shortcut 1") { [weak self] _ in + self?.alert(1) + } + .setShortcut(for: .testShortcut1) + + testMenu.addCallbackItem("Shortcut 2") { [weak self] _ in + self?.alert(2) + } + .setShortcut(for: .testShortcut2) + + testMenu.addCallbackItem("Shortcut 3") { [weak self] _ in + self?.alert(3) + } + .setShortcut(for: .testShortcut3) + + testMenu.addCallbackItem("Shortcut 4") { [weak self] _ in + self?.alert(4) + } + .setShortcut(for: .testShortcut4) + } + + private func alert(_ number: Int) { + let alert = NSAlert() + alert.messageText = "Shortcut \(number) menu item action triggered!" + alert.runModal() + } +} diff --git a/Example/KeyboardShortcutsExample/Assets.xcassets/AccentColor.colorset/Contents.json b/Example/KeyboardShortcutsExample/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/Example/KeyboardShortcutsExample/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/KeyboardShortcutsExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/KeyboardShortcutsExample/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from KeyboardShortcutsExample/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Example/KeyboardShortcutsExample/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/KeyboardShortcutsExample/Assets.xcassets/Contents.json b/Example/KeyboardShortcutsExample/Assets.xcassets/Contents.json similarity index 100% rename from KeyboardShortcutsExample/Assets.xcassets/Contents.json rename to Example/KeyboardShortcutsExample/Assets.xcassets/Contents.json diff --git a/KeyboardShortcutsExample/ContentView.swift b/Example/KeyboardShortcutsExample/ContentView.swift similarity index 98% rename from KeyboardShortcutsExample/ContentView.swift rename to Example/KeyboardShortcutsExample/ContentView.swift index fa7fcac6..72ab08ad 100644 --- a/KeyboardShortcutsExample/ContentView.swift +++ b/Example/KeyboardShortcutsExample/ContentView.swift @@ -139,6 +139,7 @@ struct ContentView: View { Divider() DynamicShortcut() } + .frame(width: 400, height: 320) } } diff --git a/KeyboardShortcutsTests/Info.plist b/Example/KeyboardShortcutsExample/Info.plist similarity index 80% rename from KeyboardShortcutsTests/Info.plist rename to Example/KeyboardShortcutsExample/Info.plist index dc68f735..17e70b2c 100644 --- a/KeyboardShortcutsTests/Info.plist +++ b/Example/KeyboardShortcutsExample/Info.plist @@ -15,8 +15,10 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.0.0 + $(MARKETING_VERSION) CFBundleVersion - 1 + $(CURRENT_PROJECT_VERSION) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) diff --git a/KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements b/Example/KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements similarity index 77% rename from KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements rename to Example/KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements index 8e790e7b..852fa1a4 100644 --- a/KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements +++ b/Example/KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements @@ -4,7 +4,5 @@ com.apple.security.app-sandbox - com.apple.security.cs.disable-library-validation - diff --git a/Example/KeyboardShortcutsExample/Preview Content/Preview Assets.xcassets/Contents.json b/Example/KeyboardShortcutsExample/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/Example/KeyboardShortcutsExample/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/KeyboardShortcutsExample/Utilities.swift b/Example/KeyboardShortcutsExample/Utilities.swift new file mode 100644 index 00000000..b3ff6567 --- /dev/null +++ b/Example/KeyboardShortcutsExample/Utilities.swift @@ -0,0 +1,109 @@ +import SwiftUI + + +final class CallbackMenuItem: NSMenuItem { + private static var validateCallback: ((NSMenuItem) -> Bool)? + + static func validate(_ callback: @escaping (NSMenuItem) -> Bool) { + validateCallback = callback + } + + init( + _ title: String, + key: String = "", + keyModifiers: NSEvent.ModifierFlags? = nil, + data: Any? = nil, + isEnabled: Bool = true, + isChecked: Bool = false, + isHidden: Bool = false, + callback: @escaping (NSMenuItem) -> Void + ) { + self.callback = callback + super.init(title: title, action: #selector(action(_:)), keyEquivalent: key) + self.target = self + self.isEnabled = isEnabled + self.isChecked = isChecked + self.isHidden = isHidden + + if let keyModifiers = keyModifiers { + self.keyEquivalentModifierMask = keyModifiers + } + } + + @available(*, unavailable) + required init(coder decoder: NSCoder) { + fatalError() + } + + private let callback: (NSMenuItem) -> Void + + @objc + func action(_ sender: NSMenuItem) { + callback(sender) + } +} + +extension CallbackMenuItem: NSMenuItemValidation { + func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { + Self.validateCallback?(menuItem) ?? true + } +} + + +extension NSMenuItem { + convenience init( + _ title: String, + action: Selector? = nil, + key: String = "", + keyModifiers: NSEvent.ModifierFlags? = nil, + data: Any? = nil, + isEnabled: Bool = true, + isChecked: Bool = false, + isHidden: Bool = false + ) { + self.init(title: title, action: action, keyEquivalent: key) + self.representedObject = data + self.isEnabled = isEnabled + self.isChecked = isChecked + self.isHidden = isHidden + + if let keyModifiers = keyModifiers { + self.keyEquivalentModifierMask = keyModifiers + } + } + + var isChecked: Bool { + get { state == .on } + set { + state = newValue ? .on : .off + } + } +} + + +extension NSMenu { + @discardableResult + func addCallbackItem( + _ title: String, + key: String = "", + keyModifiers: NSEvent.ModifierFlags? = nil, + data: Any? = nil, + isEnabled: Bool = true, + isChecked: Bool = false, + isHidden: Bool = false, + callback: @escaping (NSMenuItem) -> Void + ) -> NSMenuItem { + let menuItem = CallbackMenuItem( + title, + key: key, + keyModifiers: keyModifiers, + data: data, + isEnabled: isEnabled, + isChecked: isChecked, + isHidden: isHidden, + callback: callback + ) + addItem(menuItem) + return menuItem + } +} diff --git a/KeyboardShortcuts.podspec b/KeyboardShortcuts.podspec deleted file mode 100644 index 5326b074..00000000 --- a/KeyboardShortcuts.podspec +++ /dev/null @@ -1,14 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'KeyboardShortcuts' - s.version = '0.7.1' - s.summary = 'Add user-customizable global keyboard shortcuts to your macOS app in minutes' - s.license = 'MIT' - s.homepage = 'https://github.com/sindresorhus/KeyboardShortcuts' - s.social_media_url = 'https://twitter.com/sindresorhus' - s.authors = { 'Sindre Sorhus' => 'sindresorhus@gmail.com' } - s.source = { :git => 'https://github.com/sindresorhus/KeyboardShortcuts.git', :tag => "v#{s.version}" } - s.source_files = 'Sources/**/*.swift' - s.swift_version = '5.3' - s.platform = :macos, '10.11' - s.weak_framework = 'Combine' -end diff --git a/KeyboardShortcuts.xcodeproj/KeyboardShortcuts_Info.plist b/KeyboardShortcuts.xcodeproj/KeyboardShortcuts_Info.plist deleted file mode 100644 index ca23c84f..00000000 --- a/KeyboardShortcuts.xcodeproj/KeyboardShortcuts_Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - $(MARKETING_VERSION) - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/KeyboardShortcuts.xcodeproj/project.pbxproj b/KeyboardShortcuts.xcodeproj/project.pbxproj deleted file mode 100644 index 1f6e339f..00000000 --- a/KeyboardShortcuts.xcodeproj/project.pbxproj +++ /dev/null @@ -1,903 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 54; - objects = { - -/* Begin PBXBuildFile section */ - E3500C3624DEDCEF00F4B055 /* KeyboardShortcutsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3500C3524DEDCEF00F4B055 /* KeyboardShortcutsTests.swift */; }; - E3500C3824DEDCEF00F4B055 /* KeyboardShortcuts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "KeyboardShortcuts::KeyboardShortcuts::Product" /* KeyboardShortcuts.framework */; }; - E3500C3F24DEDDEC00F4B055 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3500C3E24DEDDEC00F4B055 /* Utilities.swift */; }; - E38103FE246449180023E9A8 /* Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38103FD246449180023E9A8 /* Name.swift */; }; - E3AD497024705C7600F51C0D /* NSMenuItem++.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3AD496F24705C7600F51C0D /* NSMenuItem++.swift */; }; - E3BF5627245C23840024D9BF /* Recorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BF5626245C23840024D9BF /* Recorder.swift */; }; - E3BF5629245C24450024D9BF /* RecorderCocoa.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BF5628245C24450024D9BF /* RecorderCocoa.swift */; }; - E3BF562B245C28BD0024D9BF /* Shortcut.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BF562A245C28BD0024D9BF /* Shortcut.swift */; }; - E3BF562D245C29C30024D9BF /* CarbonKeyboardShortcuts.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BF562C245C29C30024D9BF /* CarbonKeyboardShortcuts.swift */; }; - E3BF5635245C2BB30024D9BF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BF5634245C2BB30024D9BF /* AppDelegate.swift */; }; - E3BF5637245C2BB30024D9BF /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BF5636245C2BB30024D9BF /* ContentView.swift */; }; - E3BF5639245C2BB50024D9BF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E3BF5638245C2BB50024D9BF /* Assets.xcassets */; }; - E3BF563F245C2BB50024D9BF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E3BF563D245C2BB50024D9BF /* Main.storyboard */; }; - E3BF5646245C2D550024D9BF /* KeyboardShortcuts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "KeyboardShortcuts::KeyboardShortcuts::Product" /* KeyboardShortcuts.framework */; }; - E3BF5647245C2D550024D9BF /* KeyboardShortcuts.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = "KeyboardShortcuts::KeyboardShortcuts::Product" /* KeyboardShortcuts.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - E3BF564C245C34B30024D9BF /* Key.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BF564B245C34B30024D9BF /* Key.swift */; }; - OBJ_23 /* KeyboardShortcuts.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_9 /* KeyboardShortcuts.swift */; }; - OBJ_24 /* util.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_10 /* util.swift */; }; - OBJ_31 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_6 /* Package.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - E3500C3924DEDCEF00F4B055 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = OBJ_1 /* Project object */; - proxyType = 1; - remoteGlobalIDString = "KeyboardShortcuts::KeyboardShortcuts"; - remoteInfo = KeyboardShortcuts; - }; - E3BF5648245C2D550024D9BF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = OBJ_1 /* Project object */; - proxyType = 1; - remoteGlobalIDString = "KeyboardShortcuts::KeyboardShortcuts"; - remoteInfo = KeyboardShortcuts; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - E3BF564A245C2D550024D9BF /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - E3BF5647245C2D550024D9BF /* KeyboardShortcuts.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - E3500C3324DEDCEF00F4B055 /* KeyboardShortcutsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KeyboardShortcutsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - E3500C3524DEDCEF00F4B055 /* KeyboardShortcutsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = KeyboardShortcutsTests.swift; sourceTree = ""; usesTabs = 1; }; - E3500C3724DEDCEF00F4B055 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E3500C3E24DEDDEC00F4B055 /* Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Utilities.swift; sourceTree = ""; usesTabs = 1; }; - E38103FD246449180023E9A8 /* Name.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Name.swift; sourceTree = ""; usesTabs = 1; }; - E3AD496F24705C7600F51C0D /* NSMenuItem++.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = "NSMenuItem++.swift"; sourceTree = ""; usesTabs = 1; }; - E3BF5626245C23840024D9BF /* Recorder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Recorder.swift; sourceTree = ""; usesTabs = 1; }; - E3BF5628245C24450024D9BF /* RecorderCocoa.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = RecorderCocoa.swift; sourceTree = ""; usesTabs = 1; }; - E3BF562A245C28BD0024D9BF /* Shortcut.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Shortcut.swift; sourceTree = ""; usesTabs = 1; }; - E3BF562C245C29C30024D9BF /* CarbonKeyboardShortcuts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CarbonKeyboardShortcuts.swift; sourceTree = ""; usesTabs = 1; }; - E3BF5632245C2BB30024D9BF /* KeyboardShortcutsExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KeyboardShortcutsExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; - E3BF5634245C2BB30024D9BF /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AppDelegate.swift; sourceTree = ""; usesTabs = 1; }; - E3BF5636245C2BB30024D9BF /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ContentView.swift; sourceTree = ""; usesTabs = 1; }; - E3BF5638245C2BB50024D9BF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - E3BF563E245C2BB50024D9BF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - E3BF5640245C2BB50024D9BF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E3BF5641245C2BB50024D9BF /* KeyboardShortcutsExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = KeyboardShortcutsExample.entitlements; sourceTree = ""; }; - E3BF564B245C34B30024D9BF /* Key.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Key.swift; sourceTree = ""; usesTabs = 1; }; - "KeyboardShortcuts::KeyboardShortcuts::Product" /* KeyboardShortcuts.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = KeyboardShortcuts.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - OBJ_10 /* util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = util.swift; sourceTree = ""; usesTabs = 1; }; - OBJ_16 /* readme.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; lineEnding = 0; path = readme.md; sourceTree = ""; usesTabs = 1; }; - OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; fileEncoding = 4; lineEnding = 0; path = Package.swift; sourceTree = ""; usesTabs = 1; }; - OBJ_9 /* KeyboardShortcuts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = KeyboardShortcuts.swift; sourceTree = ""; usesTabs = 1; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - E3500C3024DEDCEF00F4B055 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - E3500C3824DEDCEF00F4B055 /* KeyboardShortcuts.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E3BF562F245C2BB30024D9BF /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - E3BF5646245C2D550024D9BF /* KeyboardShortcuts.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - OBJ_25 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - E3500C3424DEDCEF00F4B055 /* KeyboardShortcutsTests */ = { - isa = PBXGroup; - children = ( - E3500C3524DEDCEF00F4B055 /* KeyboardShortcutsTests.swift */, - E3500C3E24DEDDEC00F4B055 /* Utilities.swift */, - E3500C3724DEDCEF00F4B055 /* Info.plist */, - ); - path = KeyboardShortcutsTests; - sourceTree = ""; - }; - E3BF5633245C2BB30024D9BF /* KeyboardShortcutsExample */ = { - isa = PBXGroup; - children = ( - E3BF5634245C2BB30024D9BF /* AppDelegate.swift */, - E3BF5636245C2BB30024D9BF /* ContentView.swift */, - E3BF5638245C2BB50024D9BF /* Assets.xcassets */, - E3BF563D245C2BB50024D9BF /* Main.storyboard */, - E3BF5640245C2BB50024D9BF /* Info.plist */, - E3BF5641245C2BB50024D9BF /* KeyboardShortcutsExample.entitlements */, - ); - path = KeyboardShortcutsExample; - sourceTree = ""; - }; - E3BF5645245C2D550024D9BF /* Frameworks */ = { - isa = PBXGroup; - children = ( - ); - name = Frameworks; - sourceTree = ""; - }; - OBJ_12 /* Products */ = { - isa = PBXGroup; - children = ( - "KeyboardShortcuts::KeyboardShortcuts::Product" /* KeyboardShortcuts.framework */, - E3BF5632245C2BB30024D9BF /* KeyboardShortcutsExample.app */, - E3500C3324DEDCEF00F4B055 /* KeyboardShortcutsTests.xctest */, - ); - name = Products; - sourceTree = BUILT_PRODUCTS_DIR; - }; - OBJ_5 = { - isa = PBXGroup; - children = ( - OBJ_16 /* readme.md */, - OBJ_6 /* Package.swift */, - OBJ_7 /* Sources */, - E3BF5633245C2BB30024D9BF /* KeyboardShortcutsExample */, - E3500C3424DEDCEF00F4B055 /* KeyboardShortcutsTests */, - OBJ_12 /* Products */, - E3BF5645245C2D550024D9BF /* Frameworks */, - ); - sourceTree = ""; - }; - OBJ_7 /* Sources */ = { - isa = PBXGroup; - children = ( - OBJ_8 /* KeyboardShortcuts */, - ); - name = Sources; - sourceTree = SOURCE_ROOT; - }; - OBJ_8 /* KeyboardShortcuts */ = { - isa = PBXGroup; - children = ( - OBJ_9 /* KeyboardShortcuts.swift */, - E3BF562C245C29C30024D9BF /* CarbonKeyboardShortcuts.swift */, - E38103FD246449180023E9A8 /* Name.swift */, - E3BF564B245C34B30024D9BF /* Key.swift */, - E3BF562A245C28BD0024D9BF /* Shortcut.swift */, - E3BF5628245C24450024D9BF /* RecorderCocoa.swift */, - E3BF5626245C23840024D9BF /* Recorder.swift */, - E3AD496F24705C7600F51C0D /* NSMenuItem++.swift */, - OBJ_10 /* util.swift */, - ); - name = KeyboardShortcuts; - path = Sources/KeyboardShortcuts; - sourceTree = SOURCE_ROOT; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - E3500C3224DEDCEF00F4B055 /* KeyboardShortcutsTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = E3500C3D24DEDCEF00F4B055 /* Build configuration list for PBXNativeTarget "KeyboardShortcutsTests" */; - buildPhases = ( - E3500C2F24DEDCEF00F4B055 /* Sources */, - E3500C3024DEDCEF00F4B055 /* Frameworks */, - E3500C3124DEDCEF00F4B055 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - E3500C3A24DEDCEF00F4B055 /* PBXTargetDependency */, - ); - name = KeyboardShortcutsTests; - productName = KeyboardShortcutsTests; - productReference = E3500C3324DEDCEF00F4B055 /* KeyboardShortcutsTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - E3BF5631245C2BB30024D9BF /* KeyboardShortcutsExample */ = { - isa = PBXNativeTarget; - buildConfigurationList = E3BF5642245C2BB50024D9BF /* Build configuration list for PBXNativeTarget "KeyboardShortcutsExample" */; - buildPhases = ( - E381040124645AC80023E9A8 /* SwiftLint */, - E3BF562E245C2BB30024D9BF /* Sources */, - E3BF562F245C2BB30024D9BF /* Frameworks */, - E3BF5630245C2BB30024D9BF /* Resources */, - E3BF564A245C2D550024D9BF /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - E3BF5649245C2D550024D9BF /* PBXTargetDependency */, - ); - name = KeyboardShortcutsExample; - productName = KeyboardShortcutsExample; - productReference = E3BF5632245C2BB30024D9BF /* KeyboardShortcutsExample.app */; - productType = "com.apple.product-type.application"; - }; - "KeyboardShortcuts::KeyboardShortcuts" /* KeyboardShortcuts */ = { - isa = PBXNativeTarget; - buildConfigurationList = OBJ_19 /* Build configuration list for PBXNativeTarget "KeyboardShortcuts" */; - buildPhases = ( - E38103FF24645A410023E9A8 /* SwiftLint */, - OBJ_22 /* Sources */, - OBJ_25 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = KeyboardShortcuts; - productName = KeyboardShortcuts; - productReference = "KeyboardShortcuts::KeyboardShortcuts::Product" /* KeyboardShortcuts.framework */; - productType = "com.apple.product-type.framework"; - }; - "KeyboardShortcuts::SwiftPMPackageDescription" /* KeyboardShortcutsPackageDescription */ = { - isa = PBXNativeTarget; - buildConfigurationList = OBJ_27 /* Build configuration list for PBXNativeTarget "KeyboardShortcutsPackageDescription" */; - buildPhases = ( - OBJ_30 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = KeyboardShortcutsPackageDescription; - productName = KeyboardShortcutsPackageDescription; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - OBJ_1 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftMigration = 9999; - LastSwiftUpdateCheck = 1160; - LastUpgradeCheck = 1200; - TargetAttributes = { - E3500C3224DEDCEF00F4B055 = { - CreatedOnToolsVersion = 11.6; - }; - E3BF5631245C2BB30024D9BF = { - CreatedOnToolsVersion = 11.4.1; - }; - }; - }; - buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "KeyboardShortcuts" */; - compatibilityVersion = "Xcode 12.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = OBJ_5; - productRefGroup = OBJ_12 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - "KeyboardShortcuts::KeyboardShortcuts" /* KeyboardShortcuts */, - "KeyboardShortcuts::SwiftPMPackageDescription" /* KeyboardShortcutsPackageDescription */, - E3BF5631245C2BB30024D9BF /* KeyboardShortcutsExample */, - E3500C3224DEDCEF00F4B055 /* KeyboardShortcutsTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - E3500C3124DEDCEF00F4B055 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E3BF5630245C2BB30024D9BF /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E3BF563F245C2BB50024D9BF /* Main.storyboard in Resources */, - E3BF5639245C2BB50024D9BF /* Assets.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - E38103FF24645A410023E9A8 /* SwiftLint */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = SwiftLint; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed\"\nfi\n"; - }; - E381040124645AC80023E9A8 /* SwiftLint */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = SwiftLint; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed\"\nfi\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - E3500C2F24DEDCEF00F4B055 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E3500C3F24DEDDEC00F4B055 /* Utilities.swift in Sources */, - E3500C3624DEDCEF00F4B055 /* KeyboardShortcutsTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E3BF562E245C2BB30024D9BF /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E3BF5637245C2BB30024D9BF /* ContentView.swift in Sources */, - E3BF5635245C2BB30024D9BF /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - OBJ_22 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 0; - files = ( - OBJ_23 /* KeyboardShortcuts.swift in Sources */, - E3BF562D245C29C30024D9BF /* CarbonKeyboardShortcuts.swift in Sources */, - OBJ_24 /* util.swift in Sources */, - E3AD497024705C7600F51C0D /* NSMenuItem++.swift in Sources */, - E3BF5629245C24450024D9BF /* RecorderCocoa.swift in Sources */, - E3BF564C245C34B30024D9BF /* Key.swift in Sources */, - E3BF5627245C23840024D9BF /* Recorder.swift in Sources */, - E38103FE246449180023E9A8 /* Name.swift in Sources */, - E3BF562B245C28BD0024D9BF /* Shortcut.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - OBJ_30 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 0; - files = ( - OBJ_31 /* Package.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - E3500C3A24DEDCEF00F4B055 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = "KeyboardShortcuts::KeyboardShortcuts" /* KeyboardShortcuts */; - targetProxy = E3500C3924DEDCEF00F4B055 /* PBXContainerItemProxy */; - }; - E3BF5649245C2D550024D9BF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = "KeyboardShortcuts::KeyboardShortcuts" /* KeyboardShortcuts */; - targetProxy = E3BF5648245C2D550024D9BF /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - E3BF563D245C2BB50024D9BF /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - E3BF563E245C2BB50024D9BF /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - E3500C3B24DEDCEF00F4B055 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = YG56YK5RN5; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INFOPLIST_FILE = KeyboardShortcutsTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.15; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.KeyboardShortcutsTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - E3500C3C24DEDCEF00F4B055 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEVELOPMENT_TEAM = YG56YK5RN5; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INFOPLIST_FILE = KeyboardShortcutsTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.15; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.KeyboardShortcutsTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - E3BF5643245C2BB50024D9BF /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_ENTITLEMENTS = KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements; - CODE_SIGN_IDENTITY = "-"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = ""; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_PREVIEWS = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = KeyboardShortcutsExample/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.KeyboardShortcutsExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - E3BF5644245C2BB50024D9BF /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_ENTITLEMENTS = KeyboardShortcutsExample/KeyboardShortcutsExample.entitlements; - CODE_SIGN_IDENTITY = "-"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = ""; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_PREVIEWS = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = KeyboardShortcutsExample/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.0; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.sindresorhus.KeyboardShortcutsExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - OBJ_20 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = ""; - ENABLE_TESTABILITY = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - ); - HEADER_SEARCH_PATHS = "$(inherited)"; - INFOPLIST_FILE = KeyboardShortcuts.xcodeproj/KeyboardShortcuts_Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx", - ); - MARKETING_VERSION = 0.7.1; - OTHER_CFLAGS = "$(inherited)"; - OTHER_LDFLAGS = "$(inherited)"; - OTHER_SWIFT_FLAGS = "$(inherited)"; - PRODUCT_BUNDLE_IDENTIFIER = KeyboardShortcuts; - PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; - SWIFT_VERSION = 5.0; - TARGET_NAME = KeyboardShortcuts; - TVOS_DEPLOYMENT_TARGET = 12.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; - }; - name = Debug; - }; - OBJ_21 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = ""; - ENABLE_TESTABILITY = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - ); - HEADER_SEARCH_PATHS = "$(inherited)"; - INFOPLIST_FILE = KeyboardShortcuts.xcodeproj/KeyboardShortcuts_Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx", - ); - MARKETING_VERSION = 0.7.1; - OTHER_CFLAGS = "$(inherited)"; - OTHER_LDFLAGS = "$(inherited)"; - OTHER_SWIFT_FLAGS = "$(inherited)"; - PRODUCT_BUNDLE_IDENTIFIER = KeyboardShortcuts; - PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; - SWIFT_VERSION = 5.0; - TARGET_NAME = KeyboardShortcuts; - TVOS_DEPLOYMENT_TARGET = 12.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; - }; - name = Release; - }; - OBJ_28 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - LD = /usr/bin/true; - OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5.2.0"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - OBJ_29 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - LD = /usr/bin/true; - OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5.2.0"; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - OBJ_3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_NS_ASSERTIONS = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - "SWIFT_PACKAGE=1", - "DEBUG=1", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "-weak_framework", - Combine, - ); - OTHER_SWIFT_FLAGS = "$(inherited) -DXcode"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SUPPORTED_PLATFORMS = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE DEBUG"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - USE_HEADERMAP = NO; - }; - name = Debug; - }; - OBJ_4 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = s; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(inherited)", - "SWIFT_PACKAGE=1", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - OTHER_LDFLAGS = ( - "-weak_framework", - Combine, - ); - OTHER_SWIFT_FLAGS = "$(inherited) -DXcode"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SUPPORTED_PLATFORMS = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE"; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - USE_HEADERMAP = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - E3500C3D24DEDCEF00F4B055 /* Build configuration list for PBXNativeTarget "KeyboardShortcutsTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E3500C3B24DEDCEF00F4B055 /* Debug */, - E3500C3C24DEDCEF00F4B055 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - E3BF5642245C2BB50024D9BF /* Build configuration list for PBXNativeTarget "KeyboardShortcutsExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E3BF5643245C2BB50024D9BF /* Debug */, - E3BF5644245C2BB50024D9BF /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - OBJ_19 /* Build configuration list for PBXNativeTarget "KeyboardShortcuts" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - OBJ_20 /* Debug */, - OBJ_21 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - OBJ_2 /* Build configuration list for PBXProject "KeyboardShortcuts" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - OBJ_3 /* Debug */, - OBJ_4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - OBJ_27 /* Build configuration list for PBXNativeTarget "KeyboardShortcutsPackageDescription" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - OBJ_28 /* Debug */, - OBJ_29 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = OBJ_1 /* Project object */; -} diff --git a/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcuts-Package.xcscheme b/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcuts-Package.xcscheme deleted file mode 100644 index 748cd7d5..00000000 --- a/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcuts-Package.xcscheme +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcuts.xcscheme b/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcuts.xcscheme deleted file mode 100644 index 4a032564..00000000 --- a/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcuts.xcscheme +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcutsExample.xcscheme b/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcutsExample.xcscheme deleted file mode 100644 index 4f10a6c7..00000000 --- a/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcutsExample.xcscheme +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcutsTests.xcscheme b/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcutsTests.xcscheme deleted file mode 100644 index 69c56fd0..00000000 --- a/KeyboardShortcuts.xcodeproj/xcshareddata/xcschemes/KeyboardShortcutsTests.xcscheme +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/KeyboardShortcutsExample/AppDelegate.swift b/KeyboardShortcutsExample/AppDelegate.swift deleted file mode 100644 index bb5aceb7..00000000 --- a/KeyboardShortcutsExample/AppDelegate.swift +++ /dev/null @@ -1,93 +0,0 @@ -import Cocoa -import SwiftUI -import KeyboardShortcuts - -@main -final class AppDelegate: NSObject, NSApplicationDelegate { - private var window: NSWindow! - - func applicationDidFinishLaunching(_ notification: Notification) { - let contentView = ContentView() - - window = NSWindow( - contentRect: CGRect(x: 0, y: 0, width: 480, height: 300), - styleMask: [ - .titled, - .closable, - .miniaturizable, - .fullSizeContentView - ], - backing: .buffered, - defer: false - ) - - window.title = "KeyboardShortcuts Example" - window.center() - window.setFrameAutosaveName("Main Window") - window.contentView = NSHostingView(rootView: contentView) - window.makeKeyAndOrderFront(nil) - - createMenus() - } - - func createMenus() { - let testMenuItem = NSMenuItem() - NSApp.mainMenu?.addItem(testMenuItem) - - let testMenu = NSMenu() - testMenu.title = "Test" - testMenuItem.submenu = testMenu - - let shortcut1 = NSMenuItem() - shortcut1.title = "Shortcut 1" - shortcut1.action = #selector(shortcutAction1) - shortcut1.setShortcut(for: .testShortcut1) - testMenu.addItem(shortcut1) - - let shortcut2 = NSMenuItem() - shortcut2.title = "Shortcut 2" - shortcut2.action = #selector(shortcutAction2) - shortcut2.setShortcut(for: .testShortcut2) - testMenu.addItem(shortcut2) - - let shortcut3 = NSMenuItem() - shortcut3.title = "Shortcut 3" - shortcut3.action = #selector(shortcutAction3) - shortcut3.setShortcut(for: .testShortcut3) - testMenu.addItem(shortcut3) - - let shortcut4 = NSMenuItem() - shortcut4.title = "Shortcut 4" - shortcut4.action = #selector(shortcutAction4) - shortcut4.setShortcut(for: .testShortcut4) - testMenu.addItem(shortcut4) - } - - @objc - func shortcutAction1(_ sender: NSMenuItem) { - let alert = NSAlert() - alert.messageText = "Shortcut 1 menu item action triggered!" - alert.runModal() - } - - @objc - func shortcutAction2(_ sender: NSMenuItem) { - let alert = NSAlert() - alert.messageText = "Shortcut 2 menu item action triggered!" - alert.runModal() - } - - @objc - func shortcutAction3(_ sender: NSMenuItem) { - let alert = NSAlert() - alert.messageText = "Shortcut 3 menu item action triggered!" - alert.runModal() - } - - @objc - func shortcutAction4(_ sender: NSMenuItem) { - let alert = NSAlert() - alert.messageText = "Shortcut 4 menu item action triggered!" - alert.runModal() - } -} diff --git a/KeyboardShortcutsExample/Base.lproj/Main.storyboard b/KeyboardShortcutsExample/Base.lproj/Main.storyboard deleted file mode 100644 index 042a849c..00000000 --- a/KeyboardShortcutsExample/Base.lproj/Main.storyboard +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/KeyboardShortcutsExample/Info.plist b/KeyboardShortcutsExample/Info.plist deleted file mode 100644 index 48161877..00000000 --- a/KeyboardShortcutsExample/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - $(MARKETING_VERSION) - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSMainStoryboardFile - Main - NSPrincipalClass - NSApplication - NSSupportsAutomaticTermination - - NSSupportsSuddenTermination - - - diff --git a/Package.swift b/Package.swift index 6c308c1b..6714b139 100644 --- a/Package.swift +++ b/Package.swift @@ -18,6 +18,12 @@ let package = Package( targets: [ .target( name: "KeyboardShortcuts" + ), + .testTarget( + name: "KeyboardShortcutsTests", + dependencies: [ + "KeyboardShortcuts" + ] ) ] ) diff --git a/Sources/KeyboardShortcuts/Key.swift b/Sources/KeyboardShortcuts/Key.swift index 9b7a9fd0..cf46099f 100644 --- a/Sources/KeyboardShortcuts/Key.swift +++ b/Sources/KeyboardShortcuts/Key.swift @@ -5,6 +5,8 @@ extension KeyboardShortcuts { // swiftlint:disable identifier_name /// Represents a key on the keyboard. public struct Key: Hashable, RawRepresentable { + // MARK: Letters + public static let a = Self(kVK_ANSI_A) public static let b = Self(kVK_ANSI_B) public static let c = Self(kVK_ANSI_C) diff --git a/Sources/KeyboardShortcuts/util.swift b/Sources/KeyboardShortcuts/Utilities.swift similarity index 100% rename from Sources/KeyboardShortcuts/util.swift rename to Sources/KeyboardShortcuts/Utilities.swift diff --git a/KeyboardShortcutsTests/KeyboardShortcutsTests.swift b/Tests/KeyboardShortcutsTests/KeyboardShortcutsTests.swift similarity index 100% rename from KeyboardShortcutsTests/KeyboardShortcutsTests.swift rename to Tests/KeyboardShortcutsTests/KeyboardShortcutsTests.swift diff --git a/KeyboardShortcutsTests/Utilities.swift b/Tests/KeyboardShortcutsTests/Utilities.swift similarity index 100% rename from KeyboardShortcutsTests/Utilities.swift rename to Tests/KeyboardShortcutsTests/Utilities.swift diff --git a/readme.md b/readme.md index d1842df2..701c6b26 100644 --- a/readme.md +++ b/readme.md @@ -15,24 +15,8 @@ macOS 10.11+ ## Install -#### Swift Package Manager - Add `https://github.com/sindresorhus/KeyboardShortcuts` in the [“Swift Package Manager” tab in Xcode](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app). -You also need to set the build setting “Other Linker Flags” to `-weak_framework Combine` to work around [this Xcode bug](https://github.com/feedback-assistant/reports/issues/44). - -#### Carthage - -``` -github "sindresorhus/KeyboardShortcuts" -``` - -#### CocoaPods - -```ruby -pod 'KeyboardShortcuts' -``` - ## Usage First, register a name for the keyboard shortcut. @@ -94,7 +78,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate { **That's all! ✨** -You can find a complete example by opening `KeyboardShortcuts.xcodeproj` and then running the `KeyboardShortcutsExample` target. +You can find a complete example in the “Example” directory. You can also find a [real-world example](https://github.com/sindresorhus/Plash/blob/b348a62645a873abba8dc11ff0fb8fe423419411/Plash/PreferencesView.swift#L121-L130) in my Plash app. @@ -185,6 +169,10 @@ No. That is outside the scope of this package. You can either use [`NSEvent.addLocalMonitorForEvents`](https://developer.apple.com/documentation/appkit/nsevent/1534971-addlocalmonitorforevents), [`NSMenuItem` with keyboard shortcut](https://developer.apple.com/documentation/appkit/nsmenuitem/2880316-allowskeyequivalentwhenhidden) (it can even be hidden), or SwiftUI's [`View#keyboardShortcut()` modifier](https://developer.apple.com/documentation/swiftui/form/keyboardshortcut(_:)). +#### Can you support CocoaPods or Carthage? + +No. However, there is nothing stopping you from using Swift Package Manager for just this package even if you normally use CocoaPods or Carthage. + ## Related - [Preferences](https://github.com/sindresorhus/Preferences) - Add a preferences window to your macOS app in minutes