Let’s say you have an array of Posts you want to display in UICollectionView. To quickly show them using DTCollectionViewManager, here’s what you need to do:
Create UICollectionViewCell subclass, let’s say PostCell and adopt ModelTransfer protocol:
class PostCell : UICollectionViewCell, ModelTransfer {
func update(with model: Post) {
// Fill your cell with actual data
}
}
In your view controller:
class PostsViewController: UICollectionViewController, DTCollectionViewManageable {
override func viewDidLoad() {
super.viewDidLoad()
// Register PostCell to be used with this controller's collection view
manager.register(PostCell.self)
// Populate datasource
manager.memoryStorage.setItems(posts)
}
}
Make sure your UICollectionView outlet is wired to your class (or use UICollectionViewController subclass). If you have a PostCell.xib file, it will be automatically used for dequeueing PostCell.
That’s it! It’s that easy!
Of course, cool stuff does not stop there, framework supports all datasource and delegate methods as closures, conditional mappings and much much more! Choose what interests you in the next section of readme.
DTCollectionViewManager
Features
Read more about latest 11.0 release and integration with SwiftUI!
Requirements
Installation
Swift Package Manager
Add package into Xcode Project settings -> Swift Packages
CocoaPods:
Quick start
Let’s say you have an array of Posts you want to display in UICollectionView. To quickly show them using DTCollectionViewManager, here’s what you need to do:
ModelTransfer
protocol:Make sure your UICollectionView outlet is wired to your class (or use UICollectionViewController subclass). If you have a PostCell.xib file, it will be automatically used for dequeueing PostCell.
Of course, cool stuff does not stop there, framework supports all datasource and delegate methods as closures, conditional mappings and much much more! Choose what interests you in the next section of readme.
Burning questions
Starter pack
UICollectionView
?Advanced
Sample code and documentation
Thanks