WIP fix view constructed when not used...?

main
Mathieu GROUSSEAU 3 weeks ago
parent d89e882e2e
commit c3db0a8e86

@ -48,13 +48,27 @@ struct NewGameView: View {
Section(header: Label("newGame.timeLimit", systemImage: "stopwatch")) { Section(header: Label("newGame.timeLimit", systemImage: "stopwatch")) {
} }
}
NavigationLink(destination: IngameView(settings: vm, player1: p1, player2: p2)/*.navigationTitle("inGame.title")*/) { }.toolbar {
NavigationLink {
NavigationLazyView(IngameView(settings: vm, player1: p1, player2: p2))
// .navigationTitle(Text("Titre" as String))
} label: {
Label("newGame.play", systemImage: "play") Label("newGame.play", systemImage: "play")
} }
} }
} }
} }
// https://stackoverflow.com/questions/57594159/swiftui-navigationlink-loads-destination-view-immediately-without-clicking/61234030#61234030
struct NavigationLazyView<Content: View>: View {
let build: () -> Content
init(_ build: @autoclosure @escaping () -> Content) {
self.build = build
}
var body: Content {
build()
}
} }
private struct PlayerSectionView: View { private struct PlayerSectionView: View {

Loading…
Cancel
Save