Post

Replies

Boosts

Views

Created

searchable: Add an auxilliary search view
Is there a clean way to add an auxilliary view to the SwiftUI .searchable view? The best I have found is to add a VStack above the list being searched, but this makes the removal transition behave funny. ("Funny" means the search view and aux views animate away fine, but after they finish animating the List view snaps to the top of the screen, hiding the idle search field. The normal behavior leaves the idle search field showing.) NavigationStack { MyListView().searchable(...) } ——— struct MyListView: View { @Environment(\.isSearching) private var isSearching var body: some View { if isSearching { VStack {...my auxilliary view...} } List {...} } }
Topic: UI Frameworks SubTopic: SwiftUI
3
0
454
Sep ’24
Single window keyboard shortcut
I made a macOS document-based app that has a second scene that's a Window. It's name appears in the single window list of the Windows menu, but has no assigned shortcut. I've tried the following to assign a shortcut to it, but it doesn't add a "⌘L" as I want: Window("Logs", id: "logs") { LogsView() } .keyboardShortcut("l") I can brute-force this using .commands to replace the menu item but that seems crude and unnecessary. Is it the only way?
2
0
478
Jan ’25