Skip to content

Commit 04b8db6

Browse files
committed
Target macOS 10.15
1 parent 3b11952 commit 04b8db6

File tree

6 files changed

+12
-18
lines changed

6 files changed

+12
-18
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let package = Package(
55
name: "KeyboardShortcuts",
66
defaultLocalization: "en",
77
platforms: [
8-
.macOS(.v10_13)
8+
.macOS(.v10_15)
99
],
1010
products: [
1111
.library(

Sources/KeyboardShortcuts/KeyboardShortcuts.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ public enum KeyboardShortcuts {
457457
}
458458

459459
extension KeyboardShortcuts {
460-
@available(macOS 10.15, *)
461460
public enum EventType: Sendable {
462461
case keyDown
463462
case keyUp
@@ -492,7 +491,6 @@ extension KeyboardShortcuts {
492491

493492
- Note: This method is not affected by `.removeAllHandlers()`.
494493
*/
495-
@available(macOS 10.15, *)
496494
public static func events(for name: Name) -> AsyncStream<KeyboardShortcuts.EventType> {
497495
AsyncStream { continuation in
498496
let id = UUID()
@@ -549,12 +547,10 @@ extension KeyboardShortcuts {
549547

550548
- Note: This method is not affected by `.removeAllHandlers()`.
551549
*/
552-
@available(macOS 10.15, *)
553550
public static func events(_ type: EventType, for name: Name) -> AsyncFilterSequence<AsyncStream<EventType>> {
554551
events(for: name).filter { $0 == type }
555552
}
556553

557-
@available(macOS 10.15, *)
558554
@available(*, deprecated, renamed: "events(_:for:)")
559555
public static func on(_ type: EventType, for name: Name) -> AsyncStream<Void> {
560556
AsyncStream { continuation in

Sources/KeyboardShortcuts/Recorder.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#if os(macOS)
22
import SwiftUI
33

4-
@available(macOS 10.15, *)
54
extension KeyboardShortcuts {
65
private struct _Recorder: NSViewRepresentable { // swiftlint:disable:this type_name
76
typealias NSViewType = RecorderCocoa
@@ -88,7 +87,6 @@ extension KeyboardShortcuts {
8887
}
8988
}
9089

91-
@available(macOS 10.15, *)
9290
extension KeyboardShortcuts.Recorder<EmptyView> {
9391
/**
9492
- Parameter name: Strongly-typed keyboard shortcut name.
@@ -106,7 +104,6 @@ extension KeyboardShortcuts.Recorder<EmptyView> {
106104
}
107105
}
108106

109-
@available(macOS 10.15, *)
110107
extension KeyboardShortcuts.Recorder<Text> {
111108
/**
112109
- Parameter title: The title of the keyboard shortcut recorder, describing its purpose.
@@ -128,7 +125,6 @@ extension KeyboardShortcuts.Recorder<Text> {
128125
}
129126
}
130127

131-
@available(macOS 10.15, *)
132128
extension KeyboardShortcuts.Recorder<Text> {
133129
/**
134130
- Parameter title: The title of the keyboard shortcut recorder, describing its purpose.
@@ -151,7 +147,6 @@ extension KeyboardShortcuts.Recorder<Text> {
151147
}
152148
}
153149

154-
@available(macOS 10.15, *)
155150
extension KeyboardShortcuts.Recorder {
156151
/**
157152
- Parameter name: Strongly-typed keyboard shortcut name.
@@ -172,18 +167,16 @@ extension KeyboardShortcuts.Recorder {
172167
}
173168
}
174169

175-
@available(macOS 10.15, *)
176170
#Preview {
177171
KeyboardShortcuts.Recorder("record_shortcut", name: .init("xcodePreview"))
178172
.environment(\.locale, .init(identifier: "en"))
179173
}
180174

181-
@available(macOS 10.15, *)
182175
#Preview {
183176
KeyboardShortcuts.Recorder("record_shortcut", name: .init("xcodePreview"))
184177
.environment(\.locale, .init(identifier: "zh-Hans"))
185178
}
186-
@available(macOS 10.15, *)
179+
187180
#Preview {
188181
KeyboardShortcuts.Recorder("record_shortcut", name: .init("xcodePreview"))
189182
.environment(\.locale, .init(identifier: "ru"))

Sources/KeyboardShortcuts/Utilities.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ final class ObjectAssociation<T> {
429429
}
430430

431431

432-
@available(macOS 10.15, *)
433432
extension HorizontalAlignment {
434433
private enum ControlAlignment: AlignmentID {
435434
static func defaultValue(in context: ViewDimensions) -> CGFloat { // swiftlint:disable:this no_cgfloat
@@ -440,7 +439,6 @@ extension HorizontalAlignment {
440439
fileprivate static let controlAlignment = Self(ControlAlignment.self)
441440
}
442441

443-
@available(macOS 10.15, *)
444442
extension View {
445443
func formLabel(@ViewBuilder _ label: () -> some View) -> some View {
446444
HStack(alignment: .firstTextBaseline) {

Sources/KeyboardShortcuts/ViewModifiers.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ extension View {
1313
- Note: This method is not affected by `.removeAllHandlers()`.
1414
*/
1515
@MainActor
16-
public func onKeyboardShortcut(_ shortcut: KeyboardShortcuts.Name, perform: @escaping (KeyboardShortcuts.EventType) -> Void) -> some View {
16+
public func onKeyboardShortcut(
17+
_ shortcut: KeyboardShortcuts.Name,
18+
perform: @escaping (KeyboardShortcuts.EventType) -> Void
19+
) -> some View {
1720
task {
1821
for await eventType in KeyboardShortcuts.events(for: shortcut) {
1922
perform(eventType)
@@ -31,7 +34,11 @@ extension View {
3134
- Note: This method is not affected by `.removeAllHandlers()`.
3235
*/
3336
@MainActor
34-
public func onKeyboardShortcut(_ shortcut: KeyboardShortcuts.Name, type: KeyboardShortcuts.EventType, perform: @escaping () -> Void) -> some View {
37+
public func onKeyboardShortcut(
38+
_ shortcut: KeyboardShortcuts.Name,
39+
type: KeyboardShortcuts.EventType,
40+
perform: @escaping () -> Void
41+
) -> some View {
3542
task {
3643
for await _ in KeyboardShortcuts.events(type, for: shortcut) {
3744
perform()

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ I'm happy to accept more configurability and features. PR welcome! What you see
1212

1313
## Requirements
1414

15-
macOS 10.13+
15+
macOS 10.15+
1616

1717
## Install
1818

0 commit comments

Comments
 (0)