100 Days of SwiftUI Day 93

100 Days of SwiftUI – Day 93

We’ve arrived at day 93 of the 100 Days of SwiftUI! After finishing Flashzilla and starting the final technique project, we’re looking into positioning views and some advanced usage of GeometryReader. Let’s dive in!

Absolute positioning for SwiftUI views

SwiftUI gives us two ways of positioning views: absolute positions using position(), and relative positions using offset(). They might seem similar, but once you understand how SwiftUI places views inside frames the underlying differences between position() and offset() become clearer.

Choosing the right positioning ensures that our views are positioned correctly and our app looks its best.

Understanding frames and coordinates inside GeometryReader

We’ve used the GeometryReader many times before now. The most important thing to keep in mind is the way the GeometryReader works:

The parent proposes a size for the child, the child uses that to determine its own size, and parent uses that to position the child appropriately.

Keeping this in mind, GeometryReader allows us to use its size and coordinates to determine a child view’s layout.

Wrap up

That’s it for day 93! We’re into the final week of the course tomorrow and we start it off by wrapping up this project. Time to recharge!


Hi! My name is Darryl and this is my personal blog where I write about my journey as I learn programming! You'll also find articles about other things that interest me including games, tech and anime.

Post navigation

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

100 Days of SwiftUI – Day 87

100 Days of SwiftUI – Day 96

100 Days of SwiftUI – Day 40

100 Days of SwiftUI – Day 36 – iExpense