tabBarMinimizeBehavior(_:)
Sets the behavior for tab bar minimization.
Declaration
nonisolated func tabBarMinimizeBehavior(_ behavior: TabBarMinimizeBehavior) -> some View
Parameters
- behavior:
The minimize behavior.
Discussion
The following TabView minimizes its tab bar when scrolling in the ‘Numbers’ or ‘Alerts’ tabs on iPhone.
struct ContentView: View {
var body: some View {
TabView {
Tab("Numbers", systemImage: "number") {
ScrollView {
ForEach(0 ..< 50) { index in
Text("\(index)")
.padding()
}
}
}
Tab("Alerts", systemImage: "bell") {
AlertsView()
}
}
.tabBarMinimizeBehavior(.onScrollDown)
}
}