Font-sized Images

Often you need to include images inline in text, while being mindful of supporting all of the various user-customizable sizes of text, not to mention the accessibility sizes: One way to do this is by creating a custom SF Symbol, but that involves individually drawing or hinting each possible size. This obviously gives the optimal […]

View Builders

In the last post we looked at view modifiers as a way of building custom UI components that use other views as a form of content. In this one we’re going to look at a different approach using ViewBuilder. We’re actually going to build the exact same card structure we built before: When we used […]

View Modifiers

We’ve spent some time looking at views without really diving into what a view is, and considering what other options are available to us. Let’s look at that now. View is a defined as a protocol: This means that to conform to View we must provide a single property called body whose value is any […]

Size-Limiting Frames

Occasionally we come across a layout where we need to limit the bounds of a view in a particular dimension. For example we might have a view where we show the character portrait along with the title they might be introduced by at court. This works fine for the brawler: But for the dragoon who […]


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 […]