Reading time: 1 min

This recipe shows how to implement responsive, adaptive SwiftUI layouts using ViewThatFits. This view adapts to the available space by providing the first child view that fits. The end result looks like this:

preview

ViewThatFits is available starting in SwiftUI 4 (iOS 16, macOS 12.4).

Respo...

Continue Reading...

Reading time: 1 min

This recipe shows how to detect layout direction in your SwiftUI views, which is useful to be able to support both left-to-right (LTR) and right-to-left (RTL) languages. It also shows how to force this setting for testing purposes. The end result looks like this:

preview

Detecting layout direction
...

Continue Reading...

Reading time: 2 min

A Flow Layout is a container that orders its views sequentially, breaking into a new "line" according to the available width of the screen. You can compare it to a left-aligned block of text, where every word is a View. A common use for this layout is to create a tag cloud. The end result look...

Continue Reading...