I’ve view parentView, view B and consider C.
View parentView is a guardian view and incorporates @State bool worth which is being handed into view B and from view B to view C. The view B is inside a if assertion and the assertion is managed from view C. Nonetheless, if I alter the worth in view C, it causes the app to crash.
Im utilizing iPhone 12 Professional, iOS 16.0.2.
Right here is parentView:
@primary
struct parentView: App {
@State var isLogged: Bool = false
var physique: some Scene {
WindowGroup {
ZStack {
Colour("F6F6F6").edgesIgnoringSafeArea(.all)
if isLogged == false {
ViewA(isLogged: $isLogged)
}
}
}
}
}
Right here is view B:
struct ViewB: View {
var isLogged: Binding<Bool>
@State personal var loginNavigationIsActive = false
var physique: some View {
NavigationView {
ZStack {
Button("GO") {
loginNavigationIsActive = true
}
NavigationLink(
"",
vacation spot: ViewC(isLogged: isLogged, loginNavigationIsActive: $loginNavigationIsActive),
isActive: $loginNavigationIsActive
)
.hidden()
}
}
}
}
Right here is view C:
struct ViewC: View {
var isLogged: Binding<Bool>
var loginNavigationIsActive: Binding<Bool>
var physique: some View {
NavigationView {
ZStack {
Button("BACK") {
isLogged.wrappedValue = true
}
}
}
}
}