CollectionUI is a simple SwiftUI wrapper for (simple) UICollectionView
s.
- Select
File
/Swift Packages
/Add Package Dependency…
from the menu. - Paste
https://github.com/sbertix/CollectionUI.git
. - Follow the steps.
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()
}
}
CollectionUI is licensed under the MIT license.
Check out LICENSE for more info.