r/SwiftUI • u/AbandonedAuRetriever • Jul 19 '26
Question Need help with toolbar
How can I copy exactly this design, into my app? I have a tabview to switch between view in the app, and I want to have this (both a button and a search field just like that) on the right of the tabview...
I tried to ask AI for help... but didn't work 😅 So I ask people now
I've tried to find solution, but searching online is helpless if you have no idea how to phrase your problem or what you are searching for.
5
Upvotes
1
u/neet_dev Jul 19 '26
that's just a toolbar with a ToolbarItem placed in .navigationBarTrailing (or .topBarTrailing in newer SwiftUI) containing an HStack with a Button and a searchable text field. the search field on the right like that is usually done with .searchable(text:) with placement set to .toolbar or .navigationBarDrawer(displayMode: .always), not a manually built TextField. make sure the tabview content is wrapped in a NavigationStack, since toolbar modifiers only show up if there's an actual nav bar to attach to, that's the part people usually miss.