.tabViewStyle(.sidebarAdaptable)

Asked on 06/14/2025

1 search

The .tabViewStyle(.sidebarAdaptable) modifier in SwiftUI allows you to create a flexible tab view that can switch between a tab bar and a sidebar representation. This feature is particularly useful for apps with a lot of content, as it provides a more customizable and adaptable user interface.

In iOS 18, the sidebar has become more flexible, allowing users to reorder items and hide infrequently used options. The new type-safe syntax in SwiftUI makes it easier to catch common errors at build time. You can apply the new sidebar adaptable tab view style to make your tab view more flexible, enabling users to switch between the tab bar and the sidebar view. This is especially beneficial for apps with rich hierarchies, as it allows for a more organized and user-friendly navigation experience.

For more details, you can refer to the session What’s new in SwiftUI (00:01:02) and Elevate your tab and sidebar experience in iPadOS (00:06:16).