I have created a TabView using SwiftUI. I am trying to have the TabItems in the TabBar centered vertically. However they do not center properly.
import SwiftUI
struct ContentView: View {
var body: some View {
TabView(selection: .constant(0)) {
RouteList()
.tabItem {
Image("subway-3")
Text("Trains")
}.tag(0)
VStack {
Text("Tab 2")
}
.tabItem {
Image("subway-3")
Text("Lines")
}.tag(1)
VStack {
Text("Tab 3")
}
.tabItem {
Image(systemName: "star")
Text("Slow Zones")
}.tag(2)
}
}
}
Here you can see the result of this code.