Releases: DenTelezhkin/DTModelStorage
9.0.0
Changed
Realm CocoaPods subspec has been disabled due to realm/realm-swift#6800
9.0.0-beta.1
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.
8.1.0
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
Releasing version 8.0.0.
8.0.0-beta.2
- Added support for Xcode versions, that are older than Xcode 11.
8.0.0-beta.1
This is a major release with some breaking changes, please read DTModelStorage 8.0 Migration Guide
Added
bundle
property onViewModelMapping
, 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 betweenDTTableViewManager
/DTCollectionViewManager
and diffable datasource classes(UITableViewDiffableDataSource
`UICollectionViewDiffableDataSource`).
Changed
configureForTableViewUsage
,configureForCollectionViewUsage
,headerModel(forSection:)
,footerModel(forSection:)
, have been moved to protocol extensions instead of being implemented inBaseStorage
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 toSectionLocatable
HeaderFooterStorage
andHeaderFooterSettable
have been removedHeaderFooterStorage
functionality mostly has been merged into new protocolSupplementaryStorage
BaseStorage
has been split intoBaseSupplementaryStorage
andBaseUpdateDeliveringStorage
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 onStorage
protocol. It is replaced by more perfomantnumberOfSections()
andnumberOfItems(inSection:)
methods.sections
method onCoreDataStorage
andSingleSectionStorage
items
property onSection
protocol. It is replaced byitem(at:)
method.
7.4.1
Added
bundle
property onViewModelMapping
, 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
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
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
- Make
enqueueDatasourceUpdate
method andenqueuedDatasourceUpdates
property public to allow building custom storages that defer datasource updates.