3

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")) } } } 
2
  • 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. Commented Dec 19, 2019 at 23:10
  • Check out my solution here Commented Jan 27, 2020 at 15:01

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

Comments

2

It works on devices not on simulator.

2 Comments

Depends the OS, it's a messy bug some beta versions work some don't, some final versions work some don't. what is your device running?
Yep, this is at least true for 13.5.
1

Seems that bug is fixed on Xcode 11.4

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.