Protocol-oriented UITableView management, powered by generics and associated types.
This is a major release with some breaking changes, please read DTTableViewManager 7.0 Migration Guide
configureDiffableDataSource(modelProvider:)
method to enable UITableViewDiffableDataSource
with DTTableViewManager
.DTTableViewManageable
to implement tableView(_:viewForHeaderInSection:)
and tableView(_:viewForFooterInSection:)
to return view directly without going through storages.minimalHeaderHeightForTableView
and minimalFooterHeightForTableView
properties for TableViewConfiguration
, that allows configuring height for section headers and footers that need to be hidden.bundle
property on ViewModelMapping
in mappingBlock
. As before, bundle
defaults to Bundle(for: ViewClass.self)
.DTTableViewManager.supplementaryStorage
getter, that conditionally casts current storage to SupplementaryStorage
protocol.New method wrappers for iOS 13 API
shouldBeginMultipleSelectionInteraction
didBeginMultipleSelectionInteraction
didEndMultipleSelectionInteraction
contextMenuConfiguration(for:)
previewForHighlightingContextMenu
previewForDismissingContextMenu
willCommitMenuWithAnimator
TableViewConfiguration.display<Header/Footer>OnEmptySection
property is set to false, DTTableViewManager
no longer asks for header footer height explicitly and returns TableViewConfiguration.minimal<Header/Footer>HeightForTableView
.animateChangesOffScreen
property on TableViewUpdater
that allows to turn off animated updates for UITableView
when it is not on screen.DTModelStorage
ViewModelMappingCustomizing
protocol.DTModelStorage header, footer and supplementary model handling has been largely restructured to be a single closure-based API. Read more about changes in DTModelStorage changelog. As a result of those changes, several breaking changes in DTTableViewManager include:
SupplementaryAccessible
extension with tableHeaderModel
and tableFooterModel
properties has been removed.setSectionHeaderModels
and setSectionFooterModels
do not create sections by default, and do not call tableView.reloadData.configuration.displayHeaderOnEmptySections
or configuration.displayFooterOnEmptySections
is set, headers and footers will not be displayed, since there are no sections, which is different from present sections, that contain 0 items. For example, If you need to show a header or footer in empty section using MemoryStorage, you can call memoryStorage.setItems([Int](), forSectionAt: emptySectionIndex)
, and now with empty section header and footer can be displayed.Other breaking changes:
tableViewUpdater
will contain nil if DTTableViewManager
is configured to work with UITableViewDiffableDataSource
.DTTableViewOptionalManageable
protocol was removed and replaced by optionalTableView
property on DTTableViewManageable
protocol. One of tableView
/optionalTableView
properties must be implemented by DTTableViewManageable
instance to work with DTTableViewManager
.Following methods have been deprecated due to their delegate methods being deprecated in iOS 13:
editActions(for:)
shouldShowMenuForItemAt
canPerformAction
performAction
DTTableViewManager
object: init(storage:)
that allows to create it's instance without initializing MemoryStorage
.defaultStorage
on DTTableViewManager
that allows to configure which Storage
class is used by default.Dependency changelog -> DTModelStorage 7.2.0 and higher
SingleSectionStorage
.nilHeaderModel
and nilFooterModel
anomalies, since in some cases it's actually a desired behavior.DTTableViewManager
. Read more about it in Anomaly Handler Readme section. Anomaly handler system requires Swift 4.1 and higher.startManaging(withDelegate:_)
method is no longer required.viewFactoryErrorHandler
deprecated property on DTTableViewManager
was removed. All previously reported errors and warnings are now a part of anomaly detecting system.editingStyle(for:_,_:)
method was replaced with editingStyle(forItem:_,:_)
method, that accepts model and indexPath closure, without cell. Reason for that is that UITableView
may call this method when cell is not actually on screen, in which case this event would not fire, and current editingStyle of the cell would be lost.performBatchUpdates
block. This system is intended to fight crash, that might happen when performBatchUpdates
method is called after UITableView.reloadData
method(for example after calling memoryStorage.setItems
, and then immediately memoryStorage.addItems
). This issue is detailed in https://github.com/DenHeadless/DTCollectionViewManager/issues/27 and https://github.com/DenHeadless/DTCollectionViewManager/issues/23. This crash can also happen, if iOS 11 API UITableView.performBatchUpdates
is used. This system is turned on by default. If, for some reason, you want to disable it and have old behavior, call:manager.memoryStorage.defersDatasourceUpdates = false
TableViewUpdater
now uses iOS 11 performBatchUpdates
API, if this API is available. This API will work properly on MemoryStorage
only if defersDatasourceUpdates
is set to true
- which is default. However, if for some reason you need to use legacy methods beginUpdates
, endUpdates
, you can enable them like so:manager.tableViewUpdater?.usesLegacyTableViewUpdateMethods = true
Please note, though, that new default behavior is recommended, because it is more stable and works the same on both UITableView and UICollectionView.
tableViewUpdater
property on DTTableViewManager
is now of TableViewUpdater
type instead of opaque StorageUpdating
type. This should ease use of this object and prevent type unneccessary type casts.