3
votes

In apples SwiftUI code tutorial called BuildingListsAndNavigation, they show you how to use NavigationLinks. However, once you click the link then hit the navigation back button, the same link is disabled till you hit another link, then hit the back button again.

This issue doesn't just happen with apple's SwiftUI tutorial, it happens in my own SwiftUI projects as well. How do I make it so I can click the same link twice in a row?

Here is some example code

struct LandmarkList: View {
    var body: some View {
        NavigationView {
            List(0 ..< 5) { number in
                NavigationLink(destination: Text("next page")) {
                        Text("Row\(number)")
                }
            }
            .navigationBarTitle(Text("Landmarks"))
        }
    }
}
3
Many of the posts were old or had other variables involved. My post is the only one I've seen with an answer that gives me a workable solution.Ungraceful
Check out my solution hereVictor Kushnerov

3 Answers

3
votes

There are 2 major bugs with NavigationLink right now. The first is the one you mention about you cannot visit the same link twice. If you decide to add a second link so that to at least test your UI you hit the second bug which is when you tap the second link then after it pushes it then pops back to root.

This is with the latest Xcode Version 11.3 (11C29) and its included iOS 13.3 (17C45) Simulator.

iOS 13.3 (17C45) on iPhone XR doesn't have these bugs which is very strange given it is the same build number as the Simulator.

2
votes

It works on devices not on simulator.

1
votes

Seems that bug is fixed on Xcode 11.4