how to add a search in the tab bar
Asked on 2025-07-31
•@wwdc251 search
To add a search feature in the tab bar of your app, you can follow the guidance provided in the WWDC sessions. Here are the steps for both UIKit and SwiftUI:
UIKit
In a UIKit app, you can include a distinct tab for search in the tab bar. When the search tab is tapped, the search button expands into a search field, and the other buttons collapse. This setup is ideal for providing search suggestions and allowing users to start searching immediately. To have the search field activate automatically when the search tab is tapped, set automaticallyActivateSearch
to true
on that tab. For more details, you can refer to the session Build a UIKit app with the new design.
SwiftUI
In a SwiftUI app, you can set a search role on one of your tabs and place a searchable
modifier on your tab view. When the search tab is selected, a search field takes the place of the tab bar, and the content of the tab is shown. This allows users to interact with browsing suggestions or tap on the search field to bring up the keyboard. For more information, see the session Build a SwiftUI app with the new design.
These patterns provide flexibility and control over the search experience in your app, making it easier for users to find what they are looking for.

Build a UIKit app with the new design
Update your UIKit app to take full advantage of the new design system. We’ll dive into key changes to tab views, split views, bars, presentations, search, and controls, and show you how to use Liquid Glass in your custom UI. To get the most out of this video, we recommend first watching “Get to know the new design system” for general design guidance.

Build a SwiftUI app with the new design
Explore the ways Liquid Glass transforms the look and feel of your app. Discover how this stunning new material enhances toolbars, controls, and app structures across platforms, providing delightful interactions and seamlessly integrating your app with the system. Learn how to adopt new APIs that can help you make the most of Liquid Glass.

What’s new in SwiftUI
Learn what’s new in SwiftUI to build great apps for any Apple platform. We’ll explore how to give your app a brand new look and feel with Liquid Glass. Discover how to boost performance with framework enhancements and new instruments, and integrate advanced capabilities like web content and rich text editing. We’ll also show you how SwiftUI is expanding to more places, including laying out views in three dimensions.