Navigation Links not working after latest Xcode update

108 Views Asked by At

Following updating Xcode to 12.5 i ran my project through the simulator and certain links are not now working properly, they were working properly before the update.

When I click on the link the new view builds but then immediately closes and returns to the previous view. An example of the navigation link code is shown below, this code format is used in numerous links in the project and they still work but certain ones do not and there is no logic to which ones work and which don't, it appears random.

HStack {
   
                
          NavigationLink(destination: AllM4Hole11View(scoreManager: scoreManager, course: course), tag: "Hole11", selection: $selection) { EmptyView() }
                                
          ZStack {
                                
                 Button("") {
                       self.selection = "Hole11"
                 }.buttonStyle(ButtonNavigate())
                                    
                 Text("Go To Hole No \(course.hole11no)")
                 .foregroundColor(ColorManager.Purple)
                 .font(.system(size: 16, weight: .bold, design: .rounded))
                 }
                 }

It appears that when clicking the link the target view builds but then the "back" function activates immediately and returns me to the previous screen.

In terms of the "back"function my code is as follows

.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: Button(action: {
     self.mode.wrappedValue.dismiss()
}){
 Text("<< Back To Hole No \(course.hole10no)")
     .foregroundColor(ColorManager.Purple)
})

This code format again is used in various places in the project where it works correctly.

I have installed the code on an iPhone as well to see if it is a simulator issue but the same problems are experienced.

Has anyone had similar issues or is this a known bug in the latest Xcode update? Any advice or workarounds would be appreciated.

Thanks in advance.

0

There are 0 best solutions below