You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is entirely related to a known SwiftUI bug and the deprecation of NavLinks with isActive bindings. Effectively, isActive never gets set to false. You can confirm this by adding an onChange modifier and pressing the built in "back" button. Because it never gets set to false, setting it to true triggers no changes.
Version
iOS 16
Relevant code sample
// Here's a reproducible example:
import SwiftUI
import Combine
structContentView:View{varbody:someView{NavigationStack{VStack{Combiner(current:Screen1(), next:Combiner(current:Screen2(), next:Combiner(current:Screen3())))}}.padding()}}protocolFlowRepresentableView:View{}extensionNever:FlowRepresentableView{}classWorkflow:ObservableObject{letproceedPublisher=PassthroughSubject<Void,Never>()}structCombiner<Current:FlowRepresentableView,Next:FlowRepresentableView>:FlowRepresentableView{@Statevarcurrent:Current@Statevarnext:Next?@StatevarisActive:Bool= false
@StateObjectvarworkflow=Workflow()init(current:Current, next:Next){
_current =State(wrappedValue: current)
_next =State(wrappedValue: next)}init(current:Current)where Next ==Never{
_current =State(wrappedValue: current)
_next =State(wrappedValue:nil)}varbody:someView{Group{
if let next {NavigationLink(destination: next, isActive: $isActive){}.isDetailLink(false)}
current
}.onReceive(workflow.proceedPublisher){
isActive = true
}.environmentObject(workflow)}}structScreen1:FlowRepresentableView{@EnvironmentObjectvarworkflow:Workflowvarbody:someView{Text("\(String(describing:Self.self))").onTapGesture{
workflow.proceedPublisher.send()}}}structScreen2:FlowRepresentableView{@EnvironmentObjectvarworkflow:Workflowvarbody:someView{Text("\(String(describing:Self.self))").onTapGesture{
workflow.proceedPublisher.send()}}}structScreen3:FlowRepresentableView{@EnvironmentObjectvarworkflow:Workflowvarbody:someView{Text("\(String(describing:Self.self))").onTapGesture{
workflow.proceedPublisher.send()}}}structContentView_Previews:PreviewProvider{staticvarpreviews:someView{ContentView()}}
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
What happened?
I think this is entirely related to a known SwiftUI bug and the deprecation of NavLinks with
isActive
bindings. Effectively,isActive
never gets set tofalse
. You can confirm this by adding anonChange
modifier and pressing the built in "back" button. Because it never gets set to false, setting it to true triggers no changes.Version
iOS 16
Relevant code sample
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: