NavigationLink odd behaviour (Module 5 Lesson 9)

As I was following lesson 9 module 5 from the iOS foundation (swiftUI) syllabus (the learning App), I noticed a strange behaviour with NavigationLink. I initially thought I had made a mistake on my side so I eventually built Chris’s code directly but got the same behaviour (different from the video).

The odd behaviour is as follows: in the home view of the app, when I click on the first module ‘Learn Swift’, we navigate to the list of lessons but then immediately go back to the home view. This behaves as if the binding variable passed in the ‘selection’ argument was set to nil just after entering the ContentView.

As anyone else experienced this? Could it be due to a Swift update since it behaves differently from the video?

Thanks

Edit: still unsure what the original issue is but it seems to be fixed by using the version post lesson 14 of the app.

1 Like

@brocko

Hi Adrien,

Welcome to the code crew community.

The problem you are experiencing reared it’s ugly head when everyone upgraded to Xcode 12.5 and iOS 14.5. It’s a bug affecting NavigationLink.

This thread from the forum discusses the issue and a workaround.
https://codecrew.codewithchris.com/t/module-5-lesson-9-10-learningapp-isnt-running-anymore/12086

Awesome, thanks for the quick reply!