0Pricing
Swift Academy · Lesson

Building a Flow Layout

Wrap items across lines dynamically.

What Is a Flow Layout?

A flow layout places items left to right, wrapping to a new row when the next item would overflow the available width—like tag chips or word wrapping.

The Plan

We will compute row breaks in a shared helper, return total height from sizeThatFits, and reuse the same computation in placeSubviews. Sharing logic keeps the two methods consistent.

All lessons in this course

  1. The Layout Protocol Basics
  2. Measuring Subviews
  3. Building a Flow Layout
  4. Layout Cache and Performance
← Back to Swift Academy