SwiftUI · Navigation | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4001741-swiftui/lessons/18

Thanks for the great video. There is a missing image in the Preview Assets.

Hey thanks for the reply! I had a look at the assets and there is one for ARKit, RxSwift, Metal, SwiftUI, Team and Vapor. These are present in both starter and complete assets. Could you show me what issue you’re having please? Might just be a typo but it seems to be rendering for me :slight_smile: Thank you so much. Laurie

Thanks very much for the reply. When I look at the download assets, the “Team” image is missing. The code compiles, so, the lesson still functions, of course. Thanks again.

Screen Shot 2020-01-03 at 6.25.02 AM

Hello @gnperdue - no worries and thanks for this. As I suspected, there are a large batch of updates to this course’s project files and they are ready to deploy as soon as the team can manage to ship them to the site. These changes cover a bunch of little things like missing image assets and it should be up soon. You can grab the image from the Completed folder in the zip or from another project if its holding you up in the meantime. Many thanks and have a great day! Laurie.

1 Like

Hello how do I know that NavigationLink should only include the VStack {}, and not the GeometryReader? I would have just put NavigationLink under ForEach. Is it because Geometry reader only relates to the presentation of the components on the screen, so it should not be inside NavigationLink? I also noticed that half of the modifiers from the VStack was left out when you copied it inside the NavigationLink(EmptyView()) {}. For example .background, cornerRadius, Padding, Shadow, layoutpriority, rotation3Deffect. I am confused. I though they are the modifiers too for the VStack.

Hey @noah8610 - I am not 100% sure what you mean here however the navigation link will encompass any child views to become a tappable view that will take you to another view. The GeometryReader is useful for getting layout information about a view in its parent context for manipulating its layout later on. The reason I show you it here is that if you embed it inside a particular view, that context changes and it is no longer ‘global’ but relative to that view, and if you shift it out of there it becomes more ‘aware’ of where it is globally if that makes sense? I may have focussed on particular modifiers to try and focus on that point, feel free to add these back in and compare your results with the completed source code in the projects folder. Have a great day! :smiley: Laurie

Hello! Sorry but I can see the books of the ScrollView in the materials of this video. Do you know if it’s a problem about an actualization of Xcode, or if it’s a problem in the code?

Hello Santiago. I’m not sure what you mean here I’m afraid. If you double-check the completed project you should see everything okay. Thanks. Laurie :slight_smile:

Thanks Laurie! I was finally able to fix the problem, so don’t worry. Santiago

Xcode 12, Swift 5.3, Catalina 10.15.7

The complete project doesn’t render the same result as in the video. The added toggle code results in the HStack with the books not being shown. The screen goes white instead.

How can this be fixed?

@modnar good catch! The issue is with ZStack layoutPriority(1). Simply remove the layout priority modifier and it renders fine. We had to use this as the way ZStack behaved at the time wouldn’t always give us the results expected from the documentation we had. I’ll update the course repositories and get them merged soon.

image

Thank you for the swift :slight_smile: respons.

1 Like