Skip to content

Commit 731615a

Browse files
committed
Minor tweaks
1 parent 1b92b9b commit 731615a

File tree

9 files changed

+29
-28
lines changed

9 files changed

+29
-28
lines changed

Example/KeyboardShortcutsExample/MainScreen.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ struct MainScreen: View {
131131
}
132132
}
133133

134-
struct MainScreen_Previews: PreviewProvider {
135-
static var previews: some View {
136-
MainScreen()
137-
}
134+
#Preview {
135+
MainScreen()
138136
}

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.7
1+
// swift-tools-version:5.9
22
import PackageDescription
33

44
let package = Package(

Sources/KeyboardShortcuts/KeyboardShortcuts.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ public enum KeyboardShortcuts {
362362
You can safely call this even if the user has not yet set a keyboard shortcut. It will just be inactive until they do.
363363

364364
```swift
365-
import Cocoa
365+
import AppKit
366366
import KeyboardShortcuts
367367

368368
@main
@@ -388,7 +388,7 @@ public enum KeyboardShortcuts {
388388
You can safely call this even if the user has not yet set a keyboard shortcut. It will just be inactive until they do.
389389

390390
```swift
391-
import Cocoa
391+
import AppKit
392392
import KeyboardShortcuts
393393

394394
@main

Sources/KeyboardShortcuts/NSMenuItem++.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extension NSMenuItem {
2525
This method overrides `.keyEquivalent` and `.keyEquivalentModifierMask`.
2626

2727
```swift
28-
import Cocoa
28+
import AppKit
2929
import KeyboardShortcuts
3030

3131
extension KeyboardShortcuts.Name {

Sources/KeyboardShortcuts/Recorder.swift

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,18 @@ extension KeyboardShortcuts.Recorder {
149149
}
150150

151151
@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"))
163166
}

Sources/KeyboardShortcuts/RecorderCocoa.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Cocoa
1+
import AppKit
22
import Carbon.HIToolbox
33

44
extension KeyboardShortcuts {
@@ -12,7 +12,7 @@ extension KeyboardShortcuts {
1212
It takes care of storing the keyboard shortcut in `UserDefaults` for you.
1313

1414
```swift
15-
import Cocoa
15+
import AppKit
1616
import KeyboardShortcuts
1717

1818
final class SettingsViewController: NSViewController {

Sources/KeyboardShortcuts/Shortcut.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Cocoa
1+
import AppKit
22
import Carbon.HIToolbox
33

44
extension KeyboardShortcuts {

Sources/KeyboardShortcuts/Utilities.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,15 @@ enum AssociationPolicy {
395395
var rawValue: objc_AssociationPolicy {
396396
switch self {
397397
case .assign:
398-
return .OBJC_ASSOCIATION_ASSIGN
398+
.OBJC_ASSOCIATION_ASSIGN
399399
case .retainNonatomic:
400-
return .OBJC_ASSOCIATION_RETAIN_NONATOMIC
400+
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
401401
case .copyNonatomic:
402-
return .OBJC_ASSOCIATION_COPY_NONATOMIC
402+
.OBJC_ASSOCIATION_COPY_NONATOMIC
403403
case .retain:
404-
return .OBJC_ASSOCIATION_RETAIN
404+
.OBJC_ASSOCIATION_RETAIN
405405
case .copy:
406-
return .OBJC_ASSOCIATION_COPY
406+
.OBJC_ASSOCIATION_COPY
407407
}
408408
}
409409
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ You can also find a [real-world example](https://github.com/sindresorhus/Plash/b
100100
Using [`KeyboardShortcuts.RecorderCocoa`](Sources/KeyboardShortcuts/RecorderCocoa.swift) instead of `KeyboardShortcuts.Recorder`:
101101

102102
```swift
103-
import Cocoa
103+
import AppKit
104104
import KeyboardShortcuts
105105

106106
final class SettingsViewController: NSViewController {

0 commit comments

Comments
 (0)