All notable changes to this project will be documented in this file.
- Support for Xcode 15 (beta 1)
- Previously deprecated and marked unavailable properties:
displaySectionNameForSupplementaryKinds
,SectionModel.supplementaries
,RealmSection.supplementaries
- Compilation issue with new Realm versions (@RenGate, #36)
CellViewModelMapping
,SupplementaryViewModelMapping
base classes and several protocols to cover existing implementation ofViewModelMapping
. Concrete implementation for those base class is now a part ofDTTableViewManager
/DTCollectionViewManager
.
ViewModelMapping
andViewModelMappingProtocol
. Their functionality has been moved intoCellViewModelMapping
,SupplementaryViewModelMapping
and protocol extensions on those. Please note, that while technically those are breaking changes, usage of mappings inDTTableViewManager
/DTCollectionViewManager
is unchanged, and should not introduce breaking changes, unless those type names have been explicitly written in code.
- Package now requires Xcode 13.
Section.isEmpty
property indicating that section does not contain any elements. Accessing this property is faster than accessingSection.numberOfItems
property.
defersDatasourceUpdates
onMemoryStorage
. This property was deprecated in previous release and is now removed.MemoryStorage
now always defers updates as if this property was turned on (which was the default).ProxyDiffableDataSourceStorage
. Diffable datasource integration has been restructured in a way, that no longer requires this class.
- Ability to create
SectionModel
with array of items.
- Xcode 12.5 / Swift 5.4 warnings
- UICollectionView cell and supplementary registration from code and xib has been updated to only create
UICollectionView.CellRegistration
andUICollectionView.SupplementaryRegistration
once per mapping. This is required for proper cell and supplementary reuse.
- Realm subspec has been reenabled.
- DTModelStorage/Realm CocoaPods subspec requires Realm 10.0 and higher.
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.
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.
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.
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.
- 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.
- Added support for Xcode versions, that are older than Xcode 11.
This is a major release with some breaking changes, please read DTModelStorage 8.0 Migration Guide
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`).
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.
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.
- 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.
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.
- Support for Swift Package Manager in Xcode 11
- 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.
- Support for Swift 5 and Xcode 10.2
ViewModelMappingCustomizing
protocol. Please switch to using mapping conditions instead.
- Support for Xcode 9 and Swift 3
- Make
enqueueDatasourceUpdate
method andenqueuedDatasourceUpdates
property public to allow building custom storages that defer datasource updates.
- Single section storage classes that encapsulate single section of models with automatic diffing to animate changes. For a lot of use cases this approach is more suitable than
MemoryStorage
and is now a recommended way of handling items in single section.
Read more about it in README.
- Convenience method to create
MappingCondition
from ModelTransfer objects, for example, if used withDTTableViewManager
:
manager.register(PostCell.self) { mapping in
mapping.condition = PostCell.modelCondition { indexPath, model in
return model.isMyPost // here model type is inferred from PostCell ModelTransfer implementation
}
}
- Ability to silence anomalies, if they are expected:
memoryStorage.anomalyHandler.silenceAnomaly(.moveItemFailedItemNotFound(indexPath: IndexPath(section: 0, row: 0)))
Alternatively, you may want to silence anomaly using closure, if anomaly contents are only calculatable at runtime:
memoryStorage.anomalyHandler.silenceAnomaly { anomaly in
switch anomaly {
case .replaceItemFailedItemNotFound: return true
default: return false
}
}
- Support for Swift 4.2 and Xcode 10.
- Anomaly detecting system for various errors in
MemoryStorage
. Read more about it in DTTableViewManager Anomaly Handler Readme section. Anomaly handler system requires Swift 4.1 and higher.
- Support for Xcode 10 (beta 1) with Swift 4.1 and Swift 4.2.
- Crash that could happen if move operation for
MemoryStorage
happened from and to the same section with not enough items in section.
- Updates for Xcode 9.3 and Swift 4.1
- Properly collect all updates from updateWithoutAnimations block.
- Fixed a bug, that prevented datasource from being updated when
updateWithoutAnimations
method onMemoryStorage
was used.
- Implemented mechanism for deferring datasource updates of
MemoryStorage
. When turned on, updates are no longer applied automatically, but can be applied callingStorageUpdate.applyDeferredDatasourceUpdates()
method. Keep in mind, that not only datasource updates are not applied, but object and section changes are also empty until updates are applied. This behaviour is turned on by default, to disable it, call
MemoryStorage.defersDatasourceUpdates = false
- Ream podspec now requires
Realm
version 3.x
- Fixed warnings for Xcode 9.1 / Swift 4.0.2
- Build with Xcode 9.0 release.
This is major release, containing breaking API changes, please read DTTableViewManager 6.0 Migration Guide
MemoryStorage
now has a convenience method for moving item without animations:moveItemWithoutAnimation(from:to:)
.EventReaction
class now has 4 and 5 argument reactions- All storage protocols are now class-bound.
- Implemented mapping conditions.
ViewModelMapping
was changed to be able to work with mapping blocks.
RealmStorage
is not included in Carthage releases.setItems
method, that accepted array of arrays of items to set items for all sections, has been renamed tosetItemsForAllSections
to provide more clarity and not to clash withsetItems(_:forSection:)
method.
- Swift 3.2 support(Xcode 9 beta 1).
RealmStorage
now acceptsRealmCollection
objects into section, thus allowingList
andLinkingObjects
to be used(previously onlyResults
objects could be used in section).
- Improved handling of
NSFetchedResultsControllerDelegate
NSFetchedResultsChangeType.update
change type in cases, where object inserts/removal/moves is used simultaneously with object updates(#17).
- Reworked
EventReaction
class to useViewModelMapping
to properly identify not only model andViewType
, but alsoviewClass
. This allows event reactions to run for cases where two view subclasses, conforming toModelTransfer
, use the same model, and have similar events.
- Adds
setItems(_:)
method, that allows to set items for all sections inMemoryStorage
.
StorageUpdate
properties, that tracked changes independently of each other, have been replaced withobjectChanges
,sectionChanges
arrays, that track all changes in order they occuredStorageUpdate
now hasupdatedObjects
dictionary, that allow tracking objects, that have been updated, along with corresponding indexPath. It is done because UITableView and UICollectionView defer cell updates after insertions and deletions are completed, and therefore shift indexPaths. For example, if you were to insert 0 item and update it, UITableView would think that you are updating 1 item instead of 0, because it happens in single animation block and 0 item becomes 1.
No changes
- Requires Realm 2.0 and higher.
- Fixes crash, that happens, when subscribing to Realm notifications and Realm is read-only.
- Enables
RealmStorage
withRealmSwift
dependency
Swift 3.0 and higher is required for this version of framework.
Note Beta 1 Does not include RealmStorage subspec due to RealmSwift.framework podspec issues
UIReaction
class has been replaced with newEventReaction
class, that allows more flexible and powerful events usage- Supplementary models are now stored in
[String:[Int:Any]]
instead of[String:Any]
to support supplementary models, whose position is determined by indexPath in UICollectionView.SupplementaryStorageProtocol
,SupplementaryAccessible
protocols have been reworked to reflect those changes. MemoryStorageErrors
have been made anError
type following conventions from SE-0112.
MemoryStorage
andRealmStorage
now implementSectionLocationIdentifyable
protocol, allowing any section to find out, what it's index is.SectionModel
andRealmSection
gainedcurrentSectionIndex
property, that shows index of section in sections array.displaySectionNameForSupplementaryKinds
property onCoreDataStorage
, that defines, for which supplementary kindsNSFetchedResultsController
sectionName
should be used as a data model.removeItemsFromSection
method onMemoryStorage
, that allows to remove all items from specific section
itemForCellClass:atIndexPath:
,itemForHeaderClass:atSectionIndex:
,itemsForFooterClass:atSectionIndex:
makeNSIndexSet
method, because Swift 3 allows to directly create IndexSet from bothArray
andSet
.
CoreDataStorage
now properly updates new indexPath after Move event on iOS 9.
- Now properly handles case, when
deleteSections
method was called with index, that is not present inMemoryStorage
orRealmStorage
setSectionWithResults(_:forSectionIndex:)
forRealmStorage
Realm
dependency to1.0.0
- Support for fine-grained notifications in Realm
- Update to Realm 0.103.1 and higher.
- Fixed DenTelezhkin/DTTableViewManager#34, thanks @orkenstein, @andrewSvsg
- Realm dependency updated to 0.102 version.
- Update to Swift 2.2. This release is not backwards compatible with Swift 2.1.
insertItems(_:toIndexPaths:)
method, that mirrors UITableViewinsertRowsAtIndexPaths(_:withRowAnimation:)
and UICollectionViewinsertItemsAtIndexPaths(_:)
methodtotalNumberOfItems
computed property inMemoryStorage
, that allows getting current total number of items across all storage.
- Require Only-App-Extension-Safe API is set to YES in framework targets.
batchUpdatesInProgress
property onBaseStorage
is made public to be available in subclasses
- All methods were moved from extensions to class bodies to allow overriding them in @nonobjc subclasses.
replaceItem(_:replacingItem:)
method no longer requires second argument to be Equatable.
BaseStorage
startUpdate
andfinishUpdate
methods are now public along withcurrentUpdate
property.
RealmStorage
andRealmSection
class, that allows using Realm database results as a storage forDTTableView
andDTCollectionViewManager
.- Ability to specify xibName on
ViewModelMapping
class.
Removed API, deprecated in previous releases. All removed API calls are superseded by following replacement methods.
removeAllTableItems
,removeAllCollectionItems
->removeAllItems
moveCollectionItemAtIndexPath:toIndexPath:
,moveTableItemAtIndexPath:toIndexPath:
->moveItemAtIndexPath:toIndexPath:
moveCollectionViewSection:toSection
,moveTableViewSection:toSection
->moveSection:toSection
objectForCellClass
->itemForCellClass
objectForHeaderClass
->itemForHeaderClass
objectForFooterClass
->itemForFooterClass
objectAtIndexPath
->itemAtIndexPath
SectionModel
objects
andnumberOfObjects
->items
,numberOfItems
ViewModelMapping
class, that allows to store and retrieve mappings using type checks instead of runtime introspectionUIReaction
class, that will allowDTTableViewManager
andDTCollectionViewManager
to react to selection and configuration events. This class supersedesTableViewReaction
andCollectionViewReaction
internal classes, that previously served the same purpose.DTViewModelMappingCustomizable
protocol to allow customization ofViewModelMapping
.
RuntimeHelper
model introspection methods
performUpdates
method to perform batch updates on Storage classes.- Support for Apple TV platform (tvOS)
- Handle NSFetchedResultsController update, that may be called in a form of .Move type(iOS 9).
insertItem(_:atIndexPath:)
method now properly accepts zero index path in empty section
setSection(_:forSectionIndex:)
method to set specific section with supplementaries and reloadData
- Explicitly call storageNeedsReloading from methods
setSupplementaries
,setSectionHeaderModels
andsetSectionFooterModels
insertSection(_:atIndex:)
method that allows to insertSectionModel
directly, with items and supplementary models.
StorageUpdate
class was rewritten from scratch using Swift Set.StorageUpdate
now contains movedRowIndexPaths and movedSectionIndexes properties- All method names and properties, that contained
object
term in their name, have been renamed to read 'item' instead MemoryStorage
sectionAtIndex(_:)
method now returns optional value instead of always returningSectionModel
. This method no longer inserts new sections, when called.
removeItems
method should no longer skip items, if their indexPath is reduced when removing previous item
removeAllTableItems
andremoveAllCollectionItems
have been replaced byremoveAllItems
method.moveCollectionItemAtIndexPath:toIndexPath:
andmoveTableItemAtIndexPath:toIndexPath:
have been replaced bymoveItemAtIndexPath:toIndexPath:
methodmoveCollectionViewSection:toSection
andmoveTableViewSection:toSection
have been replaced bymoveSection:toSection
method
Framework was completely rewritten from scratch in Swift 2.
For more details, read blog post.