Swiftpack.co - Package - sbertix/CollectionUI

CollectionUI

GitHub tag (latest by date) GitHub

CollectionUI is a simple SwiftUI wrapper for (simple) UICollectionViews.

Installation

Swift Package Manager (Xcode 11 and above)

  1. Select File/Swift Packages/Add Package Dependency… from the menu.
  2. Paste https://github.com/sbertix/CollectionUI.git.
  3. Follow the steps.

Usage

import SwiftUI
import CollectionUI

/// A `View`.
struct ContentView : View {
    @State var content = ["A", "B", "C"]

    var body: some View {
        CollectionView(content, id: \.hashValue) { Text($0) }
            .axis(.horizontal)
            .indicators(false)
            .groupSize(.init(widthDimension: .fractionalWidth(0.5),
                             heightDimension: .fractionalHeight(1)))
            .itemSize(.init(widthDimension: .fractionalWidth(1),
                            heightDimension: .fractionalHeight(1)))
            .frame(minHeight: 80)
            .padding()
    }
}

License

CollectionUI is licensed under the MIT license.
Check out LICENSE for more info.

Github

link
Stars: 5

Dependencies

Used By

Total: 0