SwiftUI · ScrollView & Stacks | raywenderlich.com

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

Captions not working for this video at the middle! :thinking:

스크린샷 2020-01-08 오후 4.30.56

It seems most of image file is missing of this lecture’s project P02E06
Anyway the code works with that warning but would be better with images!
And thank you for good lecture! :slight_smile:

Hey @tkoxff and thanks for the update. Can you confirm this is from the latest projects which were updated this week? Many thanks. Laurie.

@jawad14 Please let us know what browser and operating system are you using exactly. Thank you!

It seems fine now! thanks

Safari on CatalinaOS 10.15 Beta (19A582a)

@jawad14 Do you still have issues with this?

The updated line below, does not provide the same scroll effect in the video. The cells are currently being bunched together on the left.

.rotation3DEffect(Angle(degrees: Double(proxy.frame(in: .global).midX) / 40), axis: (x: -4, y: -3, z: -3))

Hey @pagemaster - thanks for the question! Can you just double-check that the completed project in the starter files is the same as the code you’ve entered? Thank you so much and hopefully its just a small thing! Laurie.

Hey @isaacmendez - the left side bunching seems to happen in the P02E06-Complete project.

It occurs in the canvas, simulator and on real hardware. I’m running Xcode 11.5 (11E608c) on Catalina 10.15.5 (19F101).

Hey @pagemaster the pile underneath on the left is supposed to look like that if that’s what you mean? That was my design to show you what you could do so easily with scrollviews and stacks. If you mean something else just let me know.

I was surprised that a pile was being formed, yet in the video the items are scrolling off-screen (no pile).
Expected Effect

1 Like

@pagemaster yes I slightly changed the code as at the time there was a crash with that version of SwiftUI since it was so early in Beta. Sorry for any confusion. I hope you like the nice little pile - this was my intention early on as it was traditionally very hard to achieve using UICollectionViews and custom layouts. Have fun creating your own effects :slight_smile: . Laurie.

Xcode 12, Swift 5.3, Catalina 10.15.7

I’ve coded along in the starter project up until time code 8:02. And I’m 100 % sure that I’ve replicated the code correctly.

Introducing the GeometryReader results in the the HStack being shown in top off the screen in stead of centred. If I comment the GeometryReader code, the HStack is displayed centred again.

Why is this?

Coding along until time code 9:07. When the “.frame(width: 200, height: 300)” modifier is applied to the GeometryReader the HStack returns to is original centred placement.

Why is this?

Good question! Could you remove the layoutPriority modifier on the ZStack please? I commented on your other thread. This seems to fix the issue and there are details on the Navigation lecture.


We had to use layoutPriority(1) modifier as the scant documentation we had didn’t explain why some stacks in some instances didn’t layout correctly at the time despite following materials and examples from WWDC. Thankfully the workaround is no longer needed. You might find you still have issues mid-lecture with the GeometryReader because we also had to use that modifier on it. Try removing that if its causing you issues. Updated resources are on their way with comments. Thanks :slight_smile: Laurie.

Sorry, but there is no ‘layoutPriority’ modifier in the code.

Scroll Views and Stacks - ContentView line 84 on the most updated lecture notes. Are you sure this is the right episode you’re referring to? Laurie.

Ok got you. In the final state of the code, there is a call to layoutModifier. I was referencing the code state at time code 9:07.

Since my observations are made before the layoutPriority modifier is added to ZStack, it can’t be part of the solution. Sorry. Don’t feel obligated to dig further. I’ll live with the idiosyncrasy of swiftUI for now.