It seems a little odd to write a post about borders this late, since every post so far has already used them without calling them out explicitly. In each of the examples I’ve added borders to the code given to better illustrate the layout. It’s worth spending a little time looking at them in their […]


By now we should be used to the idea that all views in SwiftUI choose their own size, for example a Text view has the size required to render the string provided: Creates a view with the exact bounds necessary: We also showed that the .frame modifier actually creates a new view with the dimensions […]

Secondary Views in Practice

A secondary view, be it background or overlay, can be any view. We know from flexible frames that we can create views of fixed sizes, sizes based on their children, or sizes based on their parent. And we saw above that the proposed size of a secondary view is the fixed size of a parent. […]

Geometry Reader

For most layout needs we can combine stacks and flexible frames, allowing us to make views and controls put together from fixed size primitives views upwards. For more complex layout needs, another option is to use GeometryReader. This is a construct that acts like an infinite frame, proposing the size of its parent to its […]

Secondary Views

Secondary views are one of the more interesting layout tools available in SwiftUI, to understand them first we have to recall that views have fixed sizes. To recap the process: Parent proposes a size to its child. Child decides on its size. Parent positions the child within its bounds. Secondary views are useful because of […]

Exploding Stacks

A common layout desire is to place views in the corner of a larger view, or of the device. This is particularly interesting because it’s more instructive to visit the methods that don’t work and explain why, before showing the best way to do it. Our desired result is as follows: We’ll concentrate first on […]