9.0.0-beta.1
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 toModelTransfer.modelCondition
method, except that new method does not require cell or view to implementModelTransfer
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 forViewModelMapping
so thatViewModelMappingProtocol
instances can be stored in array, and be called without generic information.EventReaction
class has been reworked to not containViewModelMapping
instance.ViewModelMapping
class will now instead have an array ofEventReaction
instances attached to it. This way it's now possible to restrict events to only happen if currentViewModelMapping
is compatible for requested model/view/location/mapping condition.ViewModelMapping
convenience methodseventsModelMapping
andeventsViewMapping
have been removed.mappingCandidates
method now returnsViewModelMappingProtocol
instead ofViewModelMapping
performReaction
methods now acceptIndexPath
forlocation
parameter instead ofAny
.- Event reactions are moved from extension on
[ViewModelMapping]
to static methods onEventReaction
due to Swift inability to call methods on sequences that contain protocols. mappingCandidates
method has been moved toViewType
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 throughitems
property.