A Pinterest like layout in SwiftUI (horizontal & vertical).
Screen.Recording.2023-08-25.at.19.14.28.mov
The MasonryHStack
and MasonryVStack
can be used just like HStack
or VStack
:
var body: some View {
MasonryVStack(columns: 2, spacing: 20) {
// ...
}
}
Both stacks conform to the Layout
protocol so you can easily switch between other layouts as well.