Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for changeable SwiftUI .keyboardShortcuts, based on the… #181
base: main
Are you sure you want to change the base?
Added support for changeable SwiftUI .keyboardShortcuts, based on the… #181
Changes from 2 commits
08772cb
a433d93
121c3d3
3c1ac94
0ffbb47
73c82ef
bec3d76
25f1619
08a68e5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 202 in Sources/KeyboardShortcuts/RecorderCocoa.swift
GitHub Actions / lint
Check warning on line 203 in Sources/KeyboardShortcuts/RecorderCocoa.swift
GitHub Actions / lint
Check warning on line 243 in Sources/KeyboardShortcuts/RecorderCocoa.swift
GitHub Actions / lint
Check warning on line 255 in Sources/KeyboardShortcuts/RecorderCocoa.swift
GitHub Actions / lint
Check warning on line 265 in Sources/KeyboardShortcuts/RecorderCocoa.swift
GitHub Actions / lint
Check warning on line 275 in Sources/KeyboardShortcuts/RecorderCocoa.swift
GitHub Actions / lint
Check warning on line 128 in Sources/KeyboardShortcuts/Shortcut.swift
GitHub Actions / lint
Check warning on line 135 in Sources/KeyboardShortcuts/Shortcut.swift
GitHub Actions / lint
Check warning on line 258 in Sources/KeyboardShortcuts/Shortcut.swift
GitHub Actions / lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idiomatic way to do this would be to use
ViewModifier
insteadThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup - there's a view modifier directly above (which uses KeyboardShortcutView). I'm only using KeyboardShortcutView as a wrapper to store state so that the view/menu changes when the shortcut changes. If this is possible using a viewModifier function, happy to learn about it and adjust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's a
View
extension, not aViewModifier
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to do
if
and ruin the viewid
when it changes. Instead, use https://developer.apple.com/documentation/financekitui/addordertowalletbutton/keyboardshortcut(_:)-883ia#