Skip to content

Commit

Permalink
remove @ViewBuilder and tidy up a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
scornflake committed Jul 18, 2024
1 parent 0ffbb47 commit 73c82ef
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
6 changes: 0 additions & 6 deletions Sources/KeyboardShortcuts/Shortcut.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,6 @@ private let keyToKeyEquivalentString: [KeyboardShortcuts.Key: String] = [
.f20: stringFromKeyCode(NSF20FunctionKey)
]

extension KeyboardShortcuts.Key {
public var keyToCharacter: String? {
keyToCharacterMapping[self]
}
}

extension KeyboardShortcuts.Shortcut {
@MainActor // `TISGetInputSourceProperty` crashes if called on a non-main thread.
/**
Expand Down
4 changes: 1 addition & 3 deletions Sources/KeyboardShortcuts/SwiftUI+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import Foundation
import SwiftUI
import Carbon

// Provides a SwiftUI like wrapper func, that feels the same as the normal SwiftUI keyboardShortcut
// Provides a SwiftUI like wrapper function, that feels the same as the normal SwiftUI .keyboardShortcut view extension
@available(macOS 12.3, *)
extension View {
@ViewBuilder
public func keyboardShortcut(_ shortcutName: KeyboardShortcuts.Name) -> some View {
KeyboardShortcutView(shortcutName: shortcutName) {
self
Expand Down Expand Up @@ -60,7 +59,6 @@ struct KeyboardShortcutView<Content: View>: View {
// this updates the shortcut state locally, refreshing the View, thus updating the SwiftUI menu item
// It's also fine if it is nil (which happens when you set the shortcut, in RecorderCocoa).
// See the comment on becomeFirstResponder (in short: so that you can reassign the SAME keypress to a shortcut, without it whining that it's already in use)
// print("Shortcut \(shortcutName) updated to: \(current?.description ?? "nil")")
shortcut = current
}
}
Expand Down

0 comments on commit 73c82ef

Please sign in to comment.