How do I add a search tab bar in SwiftUI?
Asked on 06/14/2025
1 search
To add a search tab bar in SwiftUI, you can use the searchable
modifier on your TabView
. This is often done by setting a search role on one of your tabs, which allows the search field to take the place of the tab bar when selected. Here's a brief overview of how you can implement this:
-
Set a Search Role: Assign a search role to one of your tabs. This will configure the tab with a default title, image, and pinned placement, making it always available in the trailing edge of the tab bar.
-
Use the
searchable
Modifier: Apply thesearchable
modifier to yourTabView
. This will allow the search field to appear when the search tab is selected. On iPad and Mac, the search field will appear centered above your app's browsing suggestions. -
Implement Search Suggestions: You can enhance the search experience by adding search suggestions. This can be done by using the
searchSuggestions
modifier, which allows you to provide a list of suggestions that users can select from.
For a detailed explanation and example, you can refer to the session Build a SwiftUI app with the new design (11:10) from WWDC 2025, which covers crafting search experiences in SwiftUI apps.

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.

Elevate your tab and sidebar experience in iPadOS
iPadOS 18 introduces a new navigation system that gives people the flexibility to choose between using a tab bar or sidebar. The newly redesigned tab bar provides more space for content and other functionality. Learn how to use SwiftUI and UIKit to enable customization features – like adding, removing and reordering tabs – to enable a more personal touch in your app.

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.