Get immediate access to this and over 1,500+ other videos and books.

Boost your skills with a Beginner subscription. With over 60+ video courses and our core foundational programming books bundled in one subscription, it’s simply the best investment you can make in your development career.

ScrollView & Stacks

Note: In the demo where you use the frame modifier to affect the layout of the cells, we use a min calculation with a + operator. However, you should use a max with a -. This has been added as notes to the project and you'll be notified within the project. The line in question should be written: .frame(width: max(proxy.size.width - proxy.frame(in: .global).midX,. The culprit seems to cause a crash in the latest version of SwiftUI.

Note: In this episode, you may see the now-obsolete #if DEBUG macro, which used to be utilised for previews to run in the canvas. This is now no longer necessary, and you can safely ignore it. We’ve removed it from the project for convenience as well.

When you want to create more advanced layouts similar to UICollectionViews in SwiftUI, ScrollViews and Stacks are there to help.