File tree Expand file tree Collapse file tree 9 files changed +29
-28
lines changed
Example/KeyboardShortcutsExample
Sources/KeyboardShortcuts Expand file tree Collapse file tree 9 files changed +29
-28
lines changed Original file line number Diff line number Diff line change @@ -131,8 +131,6 @@ struct MainScreen: View {
131
131
}
132
132
}
133
133
134
- struct MainScreen_Previews : PreviewProvider {
135
- static var previews : some View {
136
- MainScreen ( )
137
- }
134
+ #Preview {
135
+ MainScreen ( )
138
136
}
Original file line number Diff line number Diff line change 1
- // swift-tools-version:5.7
1
+ // swift-tools-version:5.9
2
2
import PackageDescription
3
3
4
4
let package = Package (
Original file line number Diff line number Diff line change @@ -362,7 +362,7 @@ public enum KeyboardShortcuts {
362
362
You can safely call this even if the user has not yet set a keyboard shortcut. It will just be inactive until they do.
363
363
364
364
```swift
365
- import Cocoa
365
+ import AppKit
366
366
import KeyboardShortcuts
367
367
368
368
@main
@@ -388,7 +388,7 @@ public enum KeyboardShortcuts {
388
388
You can safely call this even if the user has not yet set a keyboard shortcut. It will just be inactive until they do.
389
389
390
390
```swift
391
- import Cocoa
391
+ import AppKit
392
392
import KeyboardShortcuts
393
393
394
394
@main
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ extension NSMenuItem {
25
25
This method overrides `.keyEquivalent` and `.keyEquivalentModifierMask`.
26
26
27
27
```swift
28
- import Cocoa
28
+ import AppKit
29
29
import KeyboardShortcuts
30
30
31
31
extension KeyboardShortcuts.Name {
Original file line number Diff line number Diff line change @@ -149,15 +149,18 @@ extension KeyboardShortcuts.Recorder {
149
149
}
150
150
151
151
@available ( macOS 10 . 15 , * )
152
- struct SwiftUI_Previews : PreviewProvider {
153
- static var previews : some View {
154
- Group {
155
- KeyboardShortcuts . Recorder ( for: . init( " xcodePreview " ) )
156
- . environment ( \. locale, . init( identifier: " en " ) )
157
- KeyboardShortcuts . Recorder ( for: . init( " xcodePreview " ) )
158
- . environment ( \. locale, . init( identifier: " zh-Hans " ) )
159
- KeyboardShortcuts . Recorder ( for: . init( " xcodePreview " ) )
160
- . environment ( \. locale, . init( identifier: " ru " ) )
161
- }
162
- }
152
+ #Preview {
153
+ KeyboardShortcuts . Recorder ( for: . init( " xcodePreview " ) )
154
+ . environment ( \. locale, . init( identifier: " en " ) )
155
+ }
156
+
157
+ @available ( macOS 10 . 15 , * )
158
+ #Preview {
159
+ KeyboardShortcuts . Recorder ( for: . init( " xcodePreview " ) )
160
+ . environment ( \. locale, . init( identifier: " zh-Hans " ) )
161
+ }
162
+ @available ( macOS 10 . 15 , * )
163
+ #Preview {
164
+ KeyboardShortcuts . Recorder ( for: . init( " xcodePreview " ) )
165
+ . environment ( \. locale, . init( identifier: " ru " ) )
163
166
}
Original file line number Diff line number Diff line change 1
- import Cocoa
1
+ import AppKit
2
2
import Carbon. HIToolbox
3
3
4
4
extension KeyboardShortcuts {
@@ -12,7 +12,7 @@ extension KeyboardShortcuts {
12
12
It takes care of storing the keyboard shortcut in `UserDefaults` for you.
13
13
14
14
```swift
15
- import Cocoa
15
+ import AppKit
16
16
import KeyboardShortcuts
17
17
18
18
final class SettingsViewController: NSViewController {
Original file line number Diff line number Diff line change 1
- import Cocoa
1
+ import AppKit
2
2
import Carbon. HIToolbox
3
3
4
4
extension KeyboardShortcuts {
Original file line number Diff line number Diff line change @@ -395,15 +395,15 @@ enum AssociationPolicy {
395
395
var rawValue : objc_AssociationPolicy {
396
396
switch self {
397
397
case . assign:
398
- return . OBJC_ASSOCIATION_ASSIGN
398
+ . OBJC_ASSOCIATION_ASSIGN
399
399
case . retainNonatomic:
400
- return . OBJC_ASSOCIATION_RETAIN_NONATOMIC
400
+ . OBJC_ASSOCIATION_RETAIN_NONATOMIC
401
401
case . copyNonatomic:
402
- return . OBJC_ASSOCIATION_COPY_NONATOMIC
402
+ . OBJC_ASSOCIATION_COPY_NONATOMIC
403
403
case . retain:
404
- return . OBJC_ASSOCIATION_RETAIN
404
+ . OBJC_ASSOCIATION_RETAIN
405
405
case . copy:
406
- return . OBJC_ASSOCIATION_COPY
406
+ . OBJC_ASSOCIATION_COPY
407
407
}
408
408
}
409
409
}
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ You can also find a [real-world example](https://github.com/sindresorhus/Plash/b
100
100
Using [ ` KeyboardShortcuts.RecorderCocoa ` ] ( Sources/KeyboardShortcuts/RecorderCocoa.swift ) instead of ` KeyboardShortcuts.Recorder ` :
101
101
102
102
``` swift
103
- import Cocoa
103
+ import AppKit
104
104
import KeyboardShortcuts
105
105
106
106
final class SettingsViewController : NSViewController {
You can’t perform that action at this time.
0 commit comments