WrkstrmKit is a Swift library that provides a set of utilities and extensions for building flexible and reusable UICollectionView-based interfaces in iOS applications.
- 🧩 Generic collection view data source
- 🎨 Customizable collection view cells
- 🔄 SwiftUI integration with UICollectionView
- 📦 Easy cell registration and dequeuing
- 🏗️ Support for supplementary views
A base class for collection view cells that can hold a model and a weak reference to a delegate view controller.
A generic view controller for managing collection views with a specific model type conforming to CollectionViewDisplayable
.
A flexible data source for UICollectionView that handles cell configuration and supplementary views.
A protocol that defines the requirements for models that can be displayed in a collection view.
A collection view cell that can host SwiftUI views, allowing for seamless integration of SwiftUI content in UICollectionView-based interfaces.
add(_:)
: Adds a registrar to register cell classes and nibs.register(nib:)
andregister(classes:)
: Convenience methods for registering multiple cell types.dequeueReusableCell(_:for:)
: Type-safe cell dequeuing.
- Create a model that conforms to
CollectionViewDisplayable
. - Implement custom collection view cells as needed.
- Use
CollectionViewController
or create your own controller that usesCollectionViewDataSource
. - Configure your data source and set it to your collection view.
class MyModel: CollectionViewDisplayable {
// Implement required methods
}
class MyViewController: CollectionViewController<MyModel> {
override func viewDidLoad() {
super.viewDidLoad()
displayableModel = MyModel()
}
}
- 📱 iOS 13.0+
- 🏎️ Swift 5.0+