Skip to content

9.0.0-beta.1

Compare
Choose a tag to compare
@DenTelezhkin DenTelezhkin released this 02 Sep 10:23
· 48 commits to main since this release

Added

  • ViewModelMapping.modelCondition method, that allows to create custom mapping condition, but infers model type from mapping. Behavior of this method is identical to ModelTransfer.modelCondition method, except that new method does not require cell or view to implement ModelTransfer protocol.
  • MemoryStorage.insertItems(_:at:) method, that allows inserting collection starting from provided indexPath. This is useful, for example, if you are using pagination, and want to insert new page of items between old pages and loading indicator.

Changed

This release requires Swift 5.3.

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

  • DTModelStorage/Realm subspec requires RealmSwift 5.2 and higher for minimum iOS 9 deployment target.

Breaking

  • ViewModelMapping has been reworked to generic class to capture both View and Model type.
  • ViewModelMappingProtocol protocol has been introduced to represent type-erased interface for ViewModelMapping so that ViewModelMappingProtocol instances can be stored in array, and be called without generic information.
  • EventReaction class has been reworked to not contain ViewModelMapping instance. ViewModelMapping class will now instead have an array of EventReaction instances attached to it. This way it's now possible to restrict events to only happen if current ViewModelMapping is compatible for requested model/view/location/mapping condition.
  • ViewModelMapping convenience methods eventsModelMapping and eventsViewMapping have been removed.
  • mappingCandidates method now returns ViewModelMappingProtocol instead of ViewModelMapping
  • performReaction methods now accept IndexPath for location parameter instead of Any.
  • Event reactions are moved from extension on [ViewModelMapping] to static methods on EventReaction due to Swift inability to call methods on sequences that contain protocols.
  • mappingCandidates method has been moved to ViewType type.
  • EventReaction has new initializers with more specific names.
  • insertItems(_:to:) method is no longer throwing. Anomaly is still produced, if count of models differs from count of indexPaths.

Deprecated

  • MemoryStorage.defersDatasourceUpdates property. Deferring datasource updates and executing them inside of performBatchUpdates block turned out to be the only stable and correct way to apply updates to both UI and datasource. It's highly recommended to leave this property on. It is now deprecated, and may be removed in the future release, maintaining current default behaviour.
  • SectionModel.setItems(_:) method. Set items directly through items property.