I would like to remove the toolbar of a TabView on macOS. Is it possible and how?
My code:
struct ContentView: View {
@State var selectionIdx = 0
var body: some View {
VStack {
HStack {
Button(action: {
selectionIdx -= 1
if selectionIdx < 0 {
selectionIdx = 0
}
}, label: {
Image(systemName: "arrowshape.left.fill")
})
Spacer()
Text("Title")
.font(.title)
Spacer()
Button(action: {
selectionIdx += 1
if selectionIdx > 2 {
selectionIdx = 2
}
}, label: {
Image(systemName: "arrowshape.forward.fill")
})
}
.padding()
TabView(selection: $selectionIdx) {
Text("Tab1")
.tag(0)
Text("Tab2")
.tag(1)
Text("Tab3")
.tag(2)
}
.padding(.horizontal)
.padding(.bottom)
}
}
}