License Language Framework

A grid that allows a two-way scroll of an infinite number of items using SwiftUI 2+.


Swift Package Manager

Add “InfiniteSnappingScrollGrid” dependency via integrated Swift Package Manager in XCode


InfiniteSnappingScrollGrid requires binding to the array of initial items. Initial items count defines the number of rows or columns displayed simultaneously inside grid bounds. Item contents will be sized equally alongside scroll axis and will be stretched to grid bounds on opposite axis. Bindings to initial items will be updated with the array of actual visible items every time the content of the grid is scrolled and snapped to new item.

Example code:

        var items = ["one", "two", "three"]
        var body: some View {
            InfiniteSnappingScrollGrid($items, alignment: .vertical) { item, index in
                // The content of single row/column
            } itemBefore: { item in
                // Returns new item that is positioned before designated item
            } itemAfter: { item in
                // Returns new item that is positioned after designated item


View Github