Learn Courses My Dashboard

iOS Foundations: Module 5 Lesson 16

I believe there is still a bug in the Learning App but it might be Xcode 13.2.1, which I am on versus Xcode 12.5, which is what Chris was using in the video. But just in case, I unzipped his solution and everything looked good. I ran his project and it is doing the same thing as mine. What is happening is when you click into a lesson, it shows the lesson and associated video for maybe 2 seconds, then jumps back out to the list of lessons. I can click on the same lesson again or even another lesson but the same thing happens. I went through the tests and those appear to work fine. Any suggestions would be appreciated. Thanks!

This is caused by a change in the way a NavigationView works and the way a NavigationLink functions inside a NavigationView.

If you add the following modifier to the closing brace of the NavigationView in HomeView, your troubles will be solved.

.navigationViewStyle(.stack)

It’s already there. Chris mentioned that one a few lessons prior to this one.

The solution provided in the Resources ( M5L16 LearningApp) does not have that modifier added. I just downloaded it to check and without that modifier the View bounces back as you are seeing. Adding that modifier to HomeView fixes that particular version.

Is that your version or the solution downloaded from the Dropbox resources for Module 5 Lesson 16?

This is what HomeView looks like in the M5L16 solution file via the DropBox resources link so I’m not sure what code you are looking at that is showing the modifier added.

The Lesson 6 solution file definitely has that modifier added but that change has not been rippled through to all the other solution versions that are available via the Dropbox resources link. For example the Lesson 7 solution does not have it as can be seen in this screenshot of the HomeView code.

Why? I don’t know but I will refer it to Chris Ching for his attention.

It’s “my” version. The one I’ve been building as I follow along with Chris in his video. I forget where/which lesson it was specifically, but he added a snippet to the video that discussed adding that modifier to the code to stop that behavior. It’s been in my code since that point.

We seem to be going around in circles here.

What you are saying is that despite that modifier being added to the code in your version of HomeView, your App does not work properly when you select “Learn Swift” (or “Learn SwiftUI” for that matter) from the opening screen and then select one of the 10 Lessons listed. In other words when you select a lesson the App returns to the Lesson list almost immediately after selecting a lesson? Have I understood you correctly?

You are correct, and I apologize if I’ve made that confusing :frowning: And to be clear, I do have the modifier

.navigationViewStyle(.stack)

following the closing brace of the NavigationView in HomeView.

So the reason that your App is behaving that way is caused by some other issue in your version unfortunately.

If you download and run the completed version from the Lesson 16 Dropbox folder you should first add that modifier to the HomeView after downloading it since, as I was alluding to in my earlier replies, all the Dropbox versions from Lesson 7 to Lesson 16 have not been updated to include that modifier. I have notified Chris Ching so hopefully they will get corrected but for the time being anyone who downloads them will be a little confused that the NavigationLink bug still exists.