MasonryStack icon indicating copy to clipboard operation
MasonryStack copied to clipboard

A Pinterest like layout in SwiftUI (horizontal & vertical).

MasonryStack

A Pinterest like layout in SwiftUI (horizontal & vertical).

https://github.com/lukepistrol/MasonryStack/assets/9460130/db3d0914-672d-4f53-8681-c28b8423994a

Usage

Note At this point this does not support lazy loading. Keep this in mind when displaying large amounts of data.

The MasonryHStack and MasonryVStack can be used just like HStack or VStack:

import SwiftUI
import MasonryStack

struct ContentView: View {
  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.


Buy Me A Coffee