У меня есть TabView в качестве главного меню в моем приложении, когда я нажимаю кнопку внутри StartGameScreen (), я полностью перехожу в другое представление и хочу, чтобы панель вкладок исчезла. Как бы я это сделал?
Мой код MainMenu ():
struct MainMenu: View {
var body: some View {
TabView{
StartGameScreen()
.tabItem {
Image(systemName: "plus.circle")
Text("New Game")
}
SavedGames()
.tabItem {
Image(systemName: "square.and.arrow.down")
Text("Saved Games")
}
}
}
}
StartGameScreen ():
var body: some View {
Form{
Section(header: Text("Teams")){
TextField("Home Team Name", text: $homeName)
TextField("Away Team Name", text: $awayName)
}
Section(header: Text("The Fixture")){
TextField("Location", text: $location)
DatePicker("Date of Fixture", selection: $date, displayedComponents: .date)
}
Section(header: Text("Officials")){
TextField("Referee", text: $referee)
TextField("Assistant Referee 1", text: $ar1)
TextField("Assistant Referee 1", text: $ar2)
TextField("4th Official", text: $fourthOfficial)
TextField("Televsion Match Official", text: $tmo)
}
Button("Start Game"){
self.processor.homeName = homeName
self.processor.awayName = awayName
self.processor.location = location
self.processor.date = date
self.processor.referee = referee
self.processor.ar1 = ar1
self.processor.ar2 = ar2
self.processor.fourthOfficial = fourthOfficial
self.processor.tmo = tmo
self.showGame.toggle()
}
}
.navigate(to: ContentView(), when: $showGame) //Custom modifier
.navigationBarTitle("New Game")
}
}