Change Log

All notable changes to this project will be documented in this file.

Next

11.0.0

Added

manager.registerHostingConfiguration(for: Post.self) { _, post, _ in
    UIHostingConfiguration {
        PostView(post: post)
    }
}

It's also possible to incorporate UIKit cell states by simply adding additional parameter to registration:

manager.registerHostingConfiguration(for: Post.self) { state, _, post, _ in
    UIHostingConfiguration {
        PostView(post: post, isSelected: state.isSelected)
    }
}

Additionally, it's possible to customize UICollectionViewCell being used to host SwiftUI view, for example for list cells:

manager.registerHostingConfiguration(for: Post.self, cell: UICollectionViewListCell.self) { _, post, _ in
    UIHostingConfiguration {
        PostView(post: post)
    }
}
manager.register(PostCell.self) { mapping in
    mapping.prefetch { model, indexPath in }
    mapping.cancelPrefetch { model, indexPath in }
}

Please note, that while datasource methods are called once per array of indexPaths, events for models will be called individually, so single model (and indexPath) is passed to each event. Theoretically, this should make prefetching and cancellation easier, since you no longer need to walk through array and find all data models, you can operate on a single data model at a time.

Deprecated

Deprecated:

    manager.register(PostCell.self)
    manager.didSelect(PostCell.self) { postCell, post, indexPath in }

Recommended:

    manager.register(PostCell.self) { mapping in
        mapping.didSelect { postCell, post, indexPath in }
    }

While previously main benefits for second syntax were mostly syntactic, now with support for SwiftUI it will be hard to actually specialize hosting cells (and might be impossible when iOS 16 hosting configuration is supported), so only second syntax will work for all kinds of cells, and first syntax can only work for non-SwiftUI cells. New delegate methods for UICollectionView (starting with iOS 16 / tvO 16 SDK) will be added only as extension to mapping protocols, not DTCollectionViewManager itself.

11.0.0-beta.1

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

Added

Changed

Breaking

10.0.0

Added

Removed

Changed

Deprecated

9.0.0-beta.1

Fixed

Removed

8.2.0

Changed

Fixed

8.1.0

This release fixes a critical issue with cell and supplementary reuse on iOS 14 / tvOS 14. If you are using 8.x release, it's highly recommended to upgrade to this release.

Changed

Deprecated

8.0.1

Fixed

8.0.0

Added

8.0.0-beta.1

This is a major release with some breaking changes, please read DTCollectionViewManager 8.0 Migration Guide

New

// Previous releases
manager.register(PostCell.self)
manager.didSelect(PostCell.self) { cell, model, indexPath in
    // React to selection
}

// New
manager.register(PostCell.self) { mapping in
    mapping.didSelect { cell, model, indexPath in

    }
}

Those events are now tied to ViewModelMapping instance, which means, that events, registered this way, will only trigger, if mapping condition of current mapping applies. For example:

manager.register(PostCell.self) { mapping in
    mapping.condition = .section(0)
    mapping.didSelect { cell, model, indexPath in  
        // This closure will only get called, when user selects cell in the first section
    }
}
manager.register(PostCell.self) { mapping in
    mapping.condition = .section(1)
    mapping.didSelect { cell, model, indexPath in  
        // This closure will only get called, when user selects cell in the second section
    }
}
manager.register(UICollectionViewCell.self, String.self) { cell, indexPath, model in
    // configure cell with model which is of type String when passed into configuration closure.
}

This is particularly useful on iOS / tvOS 14 and higher, where you can configure UICollectionViewListCell without needing to subclass it. Cells, registered in this way, can safely coexist with cells, that conform to DTModelTransfer protocol. Conditional mappings are also supported (multiple trailing closures syntax available in Swift 5.3):

manager.register(UICollectionViewCell.self, for: String.self) {
    $0.condition = .section(0)
} handler { cell, indexPath, model in
  // configure cell with model which is of type String when passed into configuration closure.
}

Changed

Breaking

This release requires Swift 5.3. Minimum iOS / tvOS deployment targets are unchanged (iOS 11, tvOS 11).

Some context: this release heavily relies on where clauses on contextually generic declarations, that are only available in Swift 5.3 - SE-0267.

register(StoryboardCell.self) { mapping in
    mapping.cellRegisteredByStoryboard = true
}

registerHeader(StoryboardHeader.self) { mapping in
    mapping.supplementaryRegisteredByStoryboard = true
}

Deprecated

Fixed

7.2.0

Changed

Please note, that this framework version source is identical to previous version, which supports iOS 8 / tvOS 9 / Swift 4.2 and higher.

7.1.0

Changed

7.0.0

7.0.0-beta.2

7.0.0-beta.1

This is a major release with some breaking changes, please read DTCollectionViewManager 7.0 Migration Guide

Changed

Added

New method wrappers for iOS 13 API

Removed

Breaking

DTModelStorage header, footer and supplementary model handling has been largely restructured to be a single closure-based API. Read more about changes in DTModelStorage changelog. As a result of those changes, several breaking changes in DTCollectionViewManager include:

Other breaking changes:

WARNING Because of default implementations for new property this will not show as a compile error, instead crashing in runtime. Please make sure to update all definitions of

var collectionView: UICollectionView?

to

var collectionView: UICollectionView!.

If you need optional collection view, use optionalCollectionView property instead.

Deprecated

Following methods have been deprecated due to their delegate methods being deprecated in iOS 13:

6.6.0

6.5.0

Added

Removed

6.4.2

6.4.1

6.4.0

6.3.0

Added

Changed

Breaking

6.1.1

6.1.0

6.1.0-beta.1

manager.memoryStorage.defersDatasourceUpdates = false

Please note, though, that new default behavior is recommended, because it is more stable and works the same on both UITableView and UICollectionView.

6.0.0

6.0.0-beta.3

6.0.0-beta.2

6.0.0-beta.1

This is a major release with some breaking changes, please read DTTableViewManager 6.0 Migration Guide

5.3.1

5.3.0

5.2.0

5.1.0

Dependency changelog -> DTModelStorage 4.0.0 and higher

5.0.0

No changes

5.0.0-beta.2

5.0.0-beta.1

This is a major release, written in Swift 3. Read Migration guide with descriptions of all features and changes.

Dependency changelog -> DTModelStorage 3.0.0 and higher

Added

Changed

Removals

4.8.0

Changed

Deprecations

4.7.0

Dependency changelog -> DTModelStorage 2.6.0 and higher

4.6.0

Dependency changelog -> DTModelStorage 2.5 and higher

Breaking

Changed

4.5.0

Dependency changelog -> DTModelStorage 2.4 and higher

Added

Changed

4.4.2

Fixed

4.4.1

Fixed

4.4.0

Dependency changelog -> DTModelStorage 2.3 and higher

This release aims to improve mapping system and error reporting.

Added

Changed

4.3.0

Dependency changelog -> DTModelStorage 2.2 and higher

Changed

Fixed

Changed

4.2.1

Updated

4.2.0

Dependency changelog -> DTModelStorage 2.1 and higher

This release aims to improve storage updates and UI animation with UICollectionView. To make this happen, DTModelStorage classes were rewritten and rearchitectured, allowing finally to remove truly historic workaround. This code was initially written to fix first item insertion and deletion of items in UICollectionView. Somewhere between iOS 6 and iOS 8 Apple has fixed bugs, that caused this behaviour to happen. This is not documented, and was not mentioned anywhere, and i was very lucky to find this out by accident. So finally, I was able to remove these workarounds(which by the way are almost two years old), and UICollectionView UI updates code is as clean as UITableView UI updates code.

There are some backwards-incompatible changes in this release, however Xcode quick-fix tips should guide you through what needs to be changed.

Added

Bugfixes

4.1.0

Features

New events registration system with method pointers, that automatically breaks retain cycles.

For example, cell selection:

manager.cellSelection(PostsViewController.selectedCell)

func selectedCell(cell: PostCell, post: Post, indexPath: NSIndexPath) {
    // Do something, push controller probably?
}

Alternatively, you can use dynamicType to register method pointer:

manager.cellSelection(self.dynamicType.selectedCell)

Other available events:

Breaking changes

beforeContentUpdate and afterContentUpdate closures were replaced with DTCollectionViewContentUpdatable protocol, that can be adopted by your DTCollectionViewManageable class, for example:

extension PostsViewController: DTCollectionViewContentUpdatable {
    func afterContentUpdate() {
        // Do something
    }
}

4.0.0

4.0 is a next major release of DTCollectionViewManager. It was rewritten from scratch in Swift 2 and is not backwards-compatible with previous releases.

Features

3.2.0

Bugfixes

3.1.1

3.1.0

Changes

3.0.5

Bugfixes

Fixed issue, that could lead to wrong collection items being removed, when using memory storage removeItemsAtIndexPaths: method.

3.0.2

Features

Added support for installation as a framework via CocoaPods - requires iOS 8 and higher deployment target.

3.0.0

3.0 is a next major release of DTCollectionViewManager. Read all about changes in detail on a wiki page.

Features

Breaking changes

2.7.0

This is a release, that is targeted at improving code readability, and reducing number of classes and protocols inside DTCollectionViewManager architecture.

Breaking changes

Features

2.6.0

Features

Add ability to use custom xibs for collection view cells and supplementary views.

2.5.0

Changes

Preliminary support for Swift.

If you use cells or supplementary views inside storyboards from Swift, implement optional reuseIdentifier method to return real Swift class name instead of the mangled one. This name should also be set as reuseIdentifier in storyboard.

2.4.0

Breaking changes

Reuse identifier now needs to be identical to cell, header or footer class names. For example, UserTableCell should now have "UserTableCell" reuse identifier.

2.3.0

Deprecations

Removed DTModelSearching protocol, please use DTMemoryStorage setSearchingBlock:forModelClass: method instead.

2.2.0

2.0.0

2.0.0

1.1.0

Features

1.0.0

First release of DTCollectionViewManager, woohoo!

Features