Value Tab View
Creates a tab view that uses a builder to create and specify selection values for its tabs.
Platform Compatibility
iOS 18.0+ iPadOS 18.0+ macOS 15.0+ watchOS 11.0+ tvOS 18.0+ visionOS 2.0+
Tags
SwiftUI Code
@State var selection = "1"
var body: some View {
let displayedSelection = Text("Selected: \(selection)")
TabView(selection: $selection) {
Tab(value: "0") {
displayedSelection
}
Tab("1", systemImage: "1.circle", value: "1") {
displayedSelection
}
Tab("2", image: "cats24x24", value: "2") {
displayedSelection
}
Tab(value: "3") {
displayedSelection
} label: {
Label("3", systemImage: "3.circle")
}
}
}Found an issue or have a suggestion?
Created: April 11, 2026Updated: April 11, 2026