Protocol-oriented UICollectionView management, powered by generics and associated types.

What's New



Introducing support for SwiftUI!

Registering SwiftUI views as content for collection view cells:

manager.registerHostingCell(for: Post.self) { model, indexPath in
    PostSwiftUIView(model: model)

This method is supported on iOS 13+ / tvOS 13+ / macCatalyst 13+.

Please note, that this integration is not supported by Apple, therefore it comes with several workarounds, read more about those in SwiftUI support document


  • HostingCellViewModelMapping - CellViewModelMapping subclass to register mappings fro SwiftUI views.
  • HostingCollectionViewCell - UICollectionViewCell subclass , implementing container for SwiftUI view embedded into it.
  • HostingCollectionViewCellConfiguration - configuration for SwiftUI views hosting inside HostingCollectionViewCell.


  • Event reactions are now defined in protocol extension instead of extending former ViewModelMapping protocol, thus allowing to call those methods not only for UIKit mappings, but SwiftUI-hosted cells as well.


  • ViewModelMapping class and it's protocol have been split into multiple classes and protocols for better subclassability (for example CellViewModelMapping / CollectionViewCellModelMapping). Please note, that while technically this is breaking, it's very unlikely to break anything in code, since this type is only present in mapping closures, and public interfaces did not change at all.

CI codecov.io CocoaPod platform CocoaPod version Swift Package Manager compatible Packagist



  • Powerful mapping system between data models and cells, headers and footers
  • Automatic datasource and interface synchronization.
  • Flexible Memory/CoreData/Realm/diffable datasource storage options
  • Powerful compile-time safe events system, that covers all of UICollectionView delegate methods
  • Views created from code, XIB, or storyboard, automatic registration and dequeue
  • Can be used with UICollectionViewController, or UIViewController with UICollectionView
  • Built-in support for iOS 14 UICollectionView.CellRegistration and content configuration
  • Unified syntax with DTTableViewManager
  • Complete documentation
  • API Reference


  • Xcode 12+
  • iOS 11.0+ / tvOS 11.0+ / macCatalyst 13.0+
  • Swift 5.3+

If you need Xcode 11 support or Swift 4...Swift 5.2, or iOS 8...iOS 10 support, you can use 7.x releases.


Swift Package Manager

Add package into Xcode Project settings -> Swift Packages


pod 'DTCollectionViewManager', '~> 11.0.0-beta.1'

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:

  1. 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
  1. In your view controller:
class PostsViewController: UICollectionViewController, DTCollectionViewManageable {

    override func viewDidLoad() {

        // Register PostCell to be used with this controller's collection view

        // Populate datasource

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.

  1. 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.

Burning questions

Starter pack

Sample code and documentation


  • Alexey Belkevich for providing initial implementation of CellFactory.
  • Michael Fey for providing insight into NSFetchedResultsController updates done right.
  • Nickolay Sheika for great feedback, that helped shaping 3.0 release and future direction of the library.
  • Artem Antihevich for great discussions about Swift generics and type capturing.


  • Swift Tools 5.5.0
View More Packages from this Author


Last updated: Mon Aug 29 2022 06:18:26 GMT-0500 (GMT-05:00)