Skip to content

Releases: DenTelezhkin/DTModelStorage

9.0.0

27 Oct 13:56
Compare
Choose a tag to compare

Changed

Realm CocoaPods subspec has been disabled due to realm/realm-swift#6800

9.0.0-beta.1

02 Sep 10:23
Compare
Choose a tag to compare

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.

8.1.0

02 Jul 09:25
Compare
Choose a tag to compare

Changed

  • Deployment targets - iOS 11 / tvOS 11.
  • Minimum Swift version required: 5.0
  • Realm dependency updated to Realm 5.

Please note, that this framework version source is identical to previous version (apart from some small Realm adjustments), which supports iOS 8 / tvOS 9 / Swift 4.0 and higher.

8.0.0

08 Nov 11:46
Compare
Choose a tag to compare
Releasing version 8.0.0.

8.0.0-beta.2

06 Sep 09:28
Compare
Choose a tag to compare
  • Added support for Xcode versions, that are older than Xcode 11.

8.0.0-beta.1

20 Aug 09:04
Compare
Choose a tag to compare

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

Added

  • bundle property on ViewModelMapping, that exposes recommended bundle to be used when searching for resources of given mapping.
  • Setter for SingleSectionStorage.items property.
  • Section.item(at:) method.
  • ProxyDiffableDataSourceStorage that serves as a bridge between DTTableViewManager/DTCollectionViewManager and diffable datasource classes(UITableViewDiffableDataSource`UICollectionViewDiffableDataSource`).

Changed

  • configureForTableViewUsage, configureForCollectionViewUsage, headerModel(forSection:), footerModel(forSection:), have been moved to protocol extensions instead of being implemented in BaseStorage class. As a consequence, BaseStorage no longer confirms to HeaderFooterStorage protocol.

Breaking

Identifiable protocol has been renamed to EntityIdentifiable protocol to avoid unwanted clashes with Foundation.Identifiable protocol, that is available on iOS 13 and higher.

Complete rewrite of header/footer/supplementary model handling. Instead of several implementations and model storages, the API now consists of three closure based properties on SupplementaryStorage protocol : headerModelProvider, footerModelProvider and supplementaryModelProvider. All storage classes implement this protocol (MemoryStorage, CoreDataStorage, RealmStorage, SingleSectionStorage, ProxyDiffableDataSourceStorage).

Storage protocols and classes have been restructured:

  • SupplementaryAccessible renamed to SectionLocatable
  • HeaderFooterStorage and HeaderFooterSettable have been removed
  • HeaderFooterStorage functionality mostly has been merged into new protocol SupplementaryStorage
  • BaseStorage has been split into BaseSupplementaryStorage and BaseUpdateDeliveringStorage that inherits from it.

Several methods continue to work, but are now bridging to new closure-based API:

  • setSectionHeaderModels
  • setSectionFooterModels
  • headerModel(forSection:)
  • footerModel(forSection:)
  • supplementaryModel(ofKind:forSectionAt:)

setSectionHeaderModels and setSectionFooterModels, as well as new closure-based API do not call reloadData method, as they were doing before. If you need to reset section headers/footers/supplementaries, consider calling StorageUpdating.storageNeedsReloading() method manually.

All methods that allowed to set header/footer/supplementary models partially, for a specific section or specific supplementary kind, have been made unavailable or removed.

CoreDataStorage now sets headerModelProvider closure to allow using FetchedResultsController section name as header instead of having arbitrary logic that compared supplementaryKind to displaySectionNameForSupplementaryKinds property, which is also made unavailable.

Removed

  • Deprecated MemoryStorageError.BatchInsertionReason enum.
  • Deprecated ViewModelMappingCustomizing protocol.
  • sections method on Storage protocol. It is replaced by more perfomant numberOfSections() and numberOfItems(inSection:) methods.
  • sections method on CoreDataStorage and SingleSectionStorage
  • items property on Section protocol. It is replaced by item(at:) method.

7.4.1

16 Jul 14:44
Compare
Choose a tag to compare

Added

  • bundle property on ViewModelMapping, that exposes recommended bundle to be used when searching for resources of given mapping.

Fixed

  • setItemsForAllSections method now properly removes all sections prior to setting new ones. This prevents a bug, where old sections could stay, if this method was called with fewer number of sections.

7.4.0

17 Jun 19:43
Compare
Choose a tag to compare

Added

  • Support for Swift Package Manager in Xcode 11

Changed

  • Slightly improved RealmStorage item(at:) method perfomance.
  • Improved StorageUpdate description.
  • ViewModelMapping.xibName can now be changed inside of mapping blocks to allow changing xibName per mapping.

7.3.0

07 Apr 11:30
Compare
Choose a tag to compare

Added

  • Support for Swift 5 and Xcode 10.2

Deprecated

  • ViewModelMappingCustomizing protocol. Please switch to using mapping conditions instead.

Removed

  • Support for Xcode 9 and Swift 3

7.2.1

01 Mar 08:18
Compare
Choose a tag to compare
  • Make enqueueDatasourceUpdate method and enqueuedDatasourceUpdates property public to allow building custom storages that defer datasource updates.