Structure¶
DefaultTabViewStyle¶
The default TabView style.¶
Declaration¶
struct DefaultTabViewStyle : TabViewStyle
Overview¶
On iOS the default TabView looks as follows: If you don't specify a tabViewStyle(_:), this is what it defaults to.
struct ContentView: View {
var body: some View {
TabView {
Text("Bananas 🍌🍌")
.tabItem {
Image(systemName: "1.circle.fill")
Text("🍌🍌")
}
Text("Apples 🍏🍏")
.tabItem {
Image(systemName: "2.square.fill")
Text("🍏🍏")
}
Text("Peaches 🍑🍑")
.tabItem {
Image(systemName: "3.square.fill")
Text("🍑🍑")
}
}
.tabViewStyle(DefaultTabViewStyle())
.font(.headline)
}
}

Since this is the default style, if you omit the line .tabViewStyle(DefaultTabViewStyle()), you get the same result:
struct ExampleView: View {
var body: some View {
TabView {
Text("Bananas 🍌🍌")
.tabItem {
Image(systemName: "1.circle.fill")
Text("🍌🍌")
}
Text("Apples 🍏🍏")
.tabItem {
Image(systemName: "2.square.fill")
Text("🍏🍏")
}
Text("Peaches 🍑🍑")
.tabItem {
Image(systemName: "3.square.fill")
Text("🍑🍑")
}
}
.font(.headline)
}
}

Availability¶
iOS 13.0+
macOS 10.15+
tvOS 13.0+
watchOS 7.0+
Topics¶
Initializer¶
init() Creates a default tab view style.