sindresorhus / KeyboardShortcuts

⌨️ Add user-customizable global keyboard shortcuts (hotkeys) to your macOS app in minutes
https://swiftpackageindex.com/sindresorhus/KeyboardShortcuts/documentation/keyboardshortcuts/keyboardshortcuts
MIT License
1.94k stars 181 forks source link

Added conditional imports for macOS in multiple files #138

Closed WalterZou closed 1 year ago

WalterZou commented 1 year ago

Add conditional imports for macOS compilation to fix import errors when used in multiple platform SwiftUI apps. #130

sindresorhus commented 1 year ago

It doesn't make sense to wrap every file in this. You can specify yourself in Xcode that a dependency is only meant for a certain platform.

WalterZou commented 1 year ago

@sindresorhus Thank you for your reply. KeyboardShortcuts is an amazing project. However, in scenarios like #130, when developing Multiple-Platform Apps with a unified target using Swift UI, even if KeyboardShortcuts are specified for macOS in Xcode, there might still be a compilation error only on macOS. This PR can address and resolve this issue.

WalterZou commented 1 year ago

After upgrading to Xcode 15 beta5, I noticed that there is no longer a need to add macOS compilation conditionals, and the compilation errors are gone (but Xcode 14 still has this issue). Therefore, I have closed this pull request. Thank you very much.