I have my app set up with tab navigation using TabView(selection: $selection) to a defaulted view. What I would like to do is set this up so that if a condition is not met, that the user is directed to another view within the tab navigation.
Any suggestions or help will be greatly appreciated!
struct TabNavigationView: View {
@AppStorage("city") var city: String?
@State var selection: String = "Today"
var body: some View {
TabView(selection: $selection) {
ChartView()
.tabItem {
Image(systemName: "star.fill")
.imageScale(.large)
Text("Today")
}
NavigationView {
LocationView()
}
.tabItem {
Image(systemName: "mappin.and.ellipse")
.imageScale(.large)
Text("Location")
}
}
}
}
Any suggestions or help will be greatly appreciated!
struct TabNavigationView: View {
@AppStorage("city") var city: String?
@State var selection: String = "Today"
var body: some View {
TabView(selection: $selection) {
ChartView()
.tabItem {
Image(systemName: "star.fill")
.imageScale(.large)
Text("Today")
}
NavigationView {
LocationView()
}
.tabItem {
Image(systemName: "mappin.and.ellipse")
.imageScale(.large)
Text("Location")
}
}
}
}