DTTableViewManager

open class DTTableViewManager

DTTableViewManager manages many of UITableView datasource and delegate methods and provides API for managing your data models in the table. Any method, that is not implemented by DTTableViewManager, will be forwarded to delegate.

See also

startManagingWithDelegate:
  • Stores all configuration options for DTTableViewManager.

    Declaration

    Swift

    open var configuration: TableViewConfiguration
  • Anomaly handler, that handles reported by DTTableViewManager anomalies.

    Declaration

    Swift

    open var anomalyHandler: DTTableViewManagerAnomalyHandler
  • Bool property, that will be true, after startManagingWithDelegate method is called on DTTableViewManager.

    Declaration

    Swift

    open var isManagingTableView: Bool { get }
  • Implicitly unwrap storage property to MemoryStorage.

    Warning

    if storage is not MemoryStorage, will throw an exception.

    Declaration

    Swift

    open var memoryStorage: MemoryStorage! { get }
  • Storage, that holds your UITableView models. By default, it’s MemoryStorage instance.

    Note

    When setting custom storage for this property, it will be automatically configured for using with UITableView and it’s delegate will be set to DTTableViewManager instance.

    Note

    Previous storage delegate property will be nilled out to avoid collisions.

    See also

    MemoryStorage, CoreDataStorage, RealmStorage.

    Declaration

    Swift

    open var storage: Storage { get set }
  • Current storage, conditionally casted to SupplementaryStorage protocol.

    Declaration

    Swift

    public var supplementaryStorage: SupplementaryStorage? { get }
  • Object, that is responsible for updating UITableView, when received update from Storage

    Declaration

    Swift

    open var tableViewUpdater: TableViewUpdater? { get set }
  • Object, that is responsible for implementing UITableViewDelegate protocol.

    Declaration

    Swift

    open var tableDelegate: DTTableViewDelegate? { get set }
  • Object, that is responsible for implementing UITableViewDataSource protocol.

    Declaration

    Swift

    open var tableDataSource: DTTableViewDataSource? { get set }
  • Object, that is responsible for implementing UITableViewDragDelegate protocol

    Declaration

    Swift

    open var tableDragDelegate: DTTableViewDragDelegate? { get set }
  • Object, that is responsible for implementing UITableViewDropDelegate protocol

    Declaration

    Swift

    open var tableDropDelegate: DTTableViewDropDelegate? { get set }
  • Storage construction block, used by DTTableViewManager when it’s created. Returns MemoryStorage by default.

    Declaration

    Swift

    public static var defaultStorage: () -> Storage
  • Creates DTTableViewManager. Usually you don’t need to call this method directly, as manager property on DTTableViewManageable instance is filled automatically. DTTableViewManager.defaultStorage closure is used to determine which Storage would be used by default.

    Declaration

    Swift

    public init(storage: Storage = DTTableViewManager.defaultStorage())

    Parameters

    storage

    storage class to be used

  • Undocumented

    Declaration

    Swift

    open func configureDiffableDataSource<SectionIdentifier, ItemIdentifier>(modelProvider: @escaping (IndexPath, ItemIdentifier) -> Any)
        -> UITableViewDiffableDataSource<SectionIdentifier, ItemIdentifier>
  • Undocumented

    Declaration

    Swift

    open func configureDiffableDataSource(modelProvider: @escaping (IndexPath, Any) -> Any) -> UITableViewDiffableDataSourceReference
  • If you access manager property when managed UITableView is already created(for example: viewDidLoad method), calling this method is not necessary. If for any reason, UITableView is created later, please call this method before modifying storage or registering cells/supplementary views.

    Precondition

    UITableView instance on delegate should not be nil.

    Note

    If delegate is DTViewModelMappingCustomizable, it will also be used to determine which view-model mapping should be used by table view factory.

    Declaration

    Swift

    open func startManaging(withDelegate delegate: DTTableViewManageable)
  • Returns closure, that updates cell at provided indexPath.

    This is used by coreDataUpdater method and can be used to silently update a cell without reload row animation.

    Declaration

    Swift

    open func updateCellClosure() -> (IndexPath, Any) -> Void
  • Updates visible cells, using tableView.indexPathsForVisibleRows, and update block. This may be more efficient than running reloadData, if number of your data models does not change, and the change you want to reflect is completely within models state.

    Declaration

    Swift

    open func updateVisibleCells(_ closure: ((UITableViewCell) -> Void)? = nil)

    Parameters

    closure

    closure to run for each cell after update has been completed.

  • Returns TableViewUpdater, configured to work with CoreDataStorage and NSFetchedResultsController updates.

    Precondition

    UITableView instance on delegate should not be nil.

    Declaration

    Swift

    open func coreDataUpdater() -> TableViewUpdater
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:canMoveRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func canMove<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Bool) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:moveRowAt:to:) method is called for cellClass.

    Warning

    This method requires items to be moved without animations, since animation has already happened when user moved those cells. If you use MemoryStorage, it’s appropriate to call memoryStorage.moveItemWithoutAnimation(from:to:) method to achieve desired behavior.

    See also

    ‘tableView:moveRowAt:to:’ method

    Declaration

    Swift

    open func move<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (_ destinationIndexPath: IndexPath, Cell, Cell.ModelType, _ sourceIndexPath: IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDataSource.sectionIndexTitles(for:_) method is called.

    Declaration

    Swift

    open func sectionIndexTitles(_ closure: @escaping () -> [String]?)
  • Registers closure to be executed, when UITableViewDataSource.tableView(_:sectionForSectionIndexTitle:at:) method is called.

    Declaration

    Swift

    open func sectionForSectionIndexTitle(_ closure: @escaping (String, Int) -> Int)
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:commitEditingStyle:forRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func commitEditingStyle<Cell>(for cellClass: Cell.Type, _ closure: @escaping (UITableViewCell.EditingStyle, Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed in UITableViewDelegate.tableView(_:canEditCellForRowAt:) method, when it’s called for cell which model is of itemType.

    Declaration

    Swift

    open func canEditCell<Model>(withItem itemType: Model.Type, _ closure: @escaping (Model, IndexPath) -> Bool)
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:didSelectRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func didSelect<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:willSelectRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func willSelect<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> IndexPath?) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:willDeselectRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func willDeselect<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> IndexPath?) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:didDeselectRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func didDeselect<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed to determine cell height in UITableViewDelegate.tableView(_:heightForRowAt:) method, when it’s called for cell which model is of itemType.

    Declaration

    Swift

    open func heightForCell<Model>(withItem itemType: Model.Type, _ closure: @escaping (Model, IndexPath) -> CGFloat)
  • Registers closure to be executed to determine estimated cell height in UITableViewDelegate.tableView(_:estimatedHeightForRowAt:) method, when it’s called for cell which model is of itemType.

    Declaration

    Swift

    open func estimatedHeightForCell<Model>(withItem itemType: Model.Type, _ closure: @escaping (Model, IndexPath) -> CGFloat)
  • Registers closure to be executed to determine indentation level in UITableViewDelegate.tableView(_:indentationLevelForRowAt:) method, when it’s called for cell which model is of itemType.

    Declaration

    Swift

    open func indentationLevelForCell<Model>(withItem itemType: Model.Type, _ closure: @escaping (Model, IndexPath) -> Int)
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:willDisplayCell:forRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func willDisplay<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:accessoryButtonTappedForRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func accessoryButtonTapped<Cell>(in cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed to determine header height in UITableViewDelegate.tableView(_:heightForHeaderInSection:) method, when it’s called for header which model is of itemType.

    Declaration

    Swift

    open func heightForHeader<Model>(withItem type: Model.Type, _ closure: @escaping (Model, Int) -> CGFloat)
  • Registers closure to be executed to determine estimated header height in UITableViewDelegate.tableView(_:estimatedHeightForHeaderInSection:) method, when it’s called for header which model is of itemType.

    Declaration

    Swift

    open func estimatedHeightForHeader<Model>(withItem type: Model.Type, _ closure: @escaping (Model, Int) -> CGFloat)
  • Registers closure to be executed to determine footer height in UITableViewDelegate.tableView(_:heightForFooterInSection:) method, when it’s called for footer which model is of itemType.

    Declaration

    Swift

    open func heightForFooter<Model>(withItem type: Model.Type, _ closure: @escaping (Model, Int) -> CGFloat)
  • Registers closure to be executed to determine estimated footer height in UITableViewDelegate.tableView(_:estimatedHeightForFooterInSection:) method, when it’s called for footer which model is of itemType.

    Declaration

    Swift

    open func estimatedHeightForFooter<Model>(withItem type: Model.Type, _ closure: @escaping (Model, Int) -> CGFloat)
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:willDisplayHeaderView:forSection:) method is called for headerClass.

    Declaration

    Swift

    open func willDisplayHeaderView<View>(_ headerClass: View.Type, _ closure: @escaping (View, View.ModelType, Int) -> Void) where View : UIView, View : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:willDisplayFooterView:forSection:) method is called for footerClass.

    Declaration

    Swift

    open func willDisplayFooterView<View>(_ footerClass: View.Type, _ closure: @escaping (View, View.ModelType, Int) -> Void) where View : UIView, View : ModelTransfer
  • Undocumented

    Declaration

    Swift

    open func editActions<Cell>(for cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> [UITableViewRowAction]?) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:willBeginEditingRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func willBeginEditing<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:didEndEditingRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func didEndEditing<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:titleForDeleteConfirmationButtonForRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func titleForDeleteConfirmationButton<Cell>(in cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> String?) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:editingStyleForRowAt:) method is called for cell that contains item ofType at indexPath.

    Declaration

    Swift

    open func editingStyle<Model>(forItem ofType: Model.Type, _ closure: @escaping (Model, IndexPath) -> UITableViewCell.EditingStyle)
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:shouldIndentWhileEditingRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func shouldIndentWhileEditing<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Bool) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:didEndDisplayingCell:forRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func didEndDisplaying<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:didEndDisplayingHeaderView:forSection:) method is called for headerClass.

    Declaration

    Swift

    open func didEndDisplayingHeaderView<View>(_ headerClass: View.Type, _ closure: @escaping (View, View.ModelType, Int) -> Void) where View : UIView, View : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:didEndDisplayingFooterView:forSection:) method is called for footerClass.

    Declaration

    Swift

    open func didEndDisplayingFooterView<View>(_ footerClass: View.Type, _ closure: @escaping (View, View.ModelType, Int) -> Void) where View : UIView, View : ModelTransfer
  • Undocumented

    Declaration

    Swift

    open func shouldShowMenu<Cell>(for cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Bool) where Cell : UITableViewCell, Cell : ModelTransfer
  • Undocumented

    Declaration

    Swift

    open func canPerformAction<Cell>(for cellClass: Cell.Type, _ closure: @escaping (Selector, Any?, Cell, Cell.ModelType, IndexPath) -> Bool) where Cell : UITableViewCell, Cell : ModelTransfer
  • Undocumented

    Declaration

    Swift

    open func performAction<Cell>(for cellClass: Cell.Type, _ closure: @escaping (Selector, Any?, Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:shouldHighlightRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func shouldHighlight<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Bool) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:didHighlightRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func didHighlight<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:didUnhighlightRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func didUnhighlight<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed, when UITableViewDelegate.tableView(_:canFocusRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func canFocus<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Bool) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed when UITableViewDelegate.tableView(_:shouldUpdateFocusInContext:) method is called.

    Declaration

    Swift

    open func shouldUpdateFocus(_ closure: @escaping (UITableViewFocusUpdateContext) -> Bool)
  • Registers closure tp be executed when UITableViewDelegate.tableView(_:didUpdateFocusIn:with:) method is called.

    Declaration

    Swift

    open func didUpdateFocus(_ closure: @escaping (UITableViewFocusUpdateContext, UIFocusAnimationCoordinator) -> Void)
  • Registers closure to be executed when UITableViewDelegate.indexPathForPreferredFocusedView(in:) method is called

    Declaration

    Swift

    open func indexPathForPreferredFocusedView(_ closure: @escaping () -> IndexPath?)
  • Registers closure to be executed when UITableViewDelegate.targetIndexPathForMoveFromRowAt(_:toProposed:) method is called for cellClass

    Declaration

    Swift

    open func targetIndexPathForMove<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (IndexPath, Cell, Cell.ModelType, IndexPath) -> IndexPath) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed when UITableViewDelegate.tableView(_:leadingSwipeActionsConfigurationForRowAt:) method is called for cellClass

    Declaration

    Swift

    open func leadingSwipeActionsConfiguration<Cell>(for cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> UISwipeActionsConfiguration?) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed when UITableViewDelegate.tableView(_:trailingSwipeActionsConfigurationForRowAt:) method is called for cellClass

    Declaration

    Swift

    open func trailingSwipeActionsConfiguration<Cell>(for cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> UISwipeActionsConfiguration?) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed when UITableViewDelegate.tableView(_:shouldSpringLoadRowAt:) method is called for cellClass.

    Declaration

    Swift

    open func shouldSpringLoad<Cell>(_ cellClass: Cell.Type, _ closure: @escaping (UISpringLoadedInteractionContext, Cell, Cell.ModelType, IndexPath) -> Bool) where Cell : UITableViewCell, Cell : ModelTransfer
  • Undocumented

    Declaration

    Swift

    open func shouldBeginMultipleSelectionInteraction<Cell:ModelTransfer>(for cellClass: Cell.Type,
                                                              _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Bool)
        where Cell: UITableViewCell
  • Undocumented

    Declaration

    Swift

    open func didBeginMultipleSelectionInteraction<Cell:ModelTransfer>(for cellClass: Cell.Type,
                                                                    _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Void)
        where Cell: UITableViewCell
  • Undocumented

    Declaration

    Swift

    open func didEndMultipleSelectionInteraction(_ closure: @escaping () -> Void)
  • Undocumented

    Declaration

    Swift

    open func contextMenuConfiguration<Cell:ModelTransfer>(for cellClass: Cell.Type,
                                                        _ closure: @escaping (CGPoint, Cell, Cell.ModelType, IndexPath) -> UIContextMenuConfiguration?)
        where Cell: UITableViewCell
  • Undocumented

    Declaration

    Swift

    open func previewForHighlightingContextMenu(_ closure: @escaping (UIContextMenuConfiguration) -> UITargetedPreview?)
  • Undocumented

    Declaration

    Swift

    open func previewForDismissingContextMenu(_ closure: @escaping (UIContextMenuConfiguration) -> UITargetedPreview?)
  • Undocumented

    Declaration

    Swift

    func registerNibNamed<T>(_ nibName: String, for cellClass: T.Type, mapping: ((ViewModelMapping<T, T.ModelType>) -> Void)? = nil) where T : UITableViewCell, T : ModelTransfer
  • Undocumented

    Declaration

    Swift

    func registerNiblessHeader<T>(_ headerClass: T.Type, mapping: ((ViewModelMapping<T, T.ModelType>) -> Void)? = nil) where T : UITableViewHeaderFooterView, T : ModelTransfer
  • Undocumented

    Declaration

    Swift

    func registerNiblessFooter<T>(_ footerClass: T.Type, mapping: ((ViewModelMapping<T, T.ModelType>) -> Void)? = nil) where T : UITableViewHeaderFooterView, T : ModelTransfer
  • Undocumented

    Declaration

    Swift

    func registerNibNamed<T>(_ nibName: String, forHeader headerClass: T.Type, mapping: ((ViewModelMapping<T, T.ModelType>) -> Void)? = nil) where T : UIView, T : ModelTransfer
  • Undocumented

    Declaration

    Swift

    func registerNibNamed<T>(_ nibName: String, forFooter footerClass: T.Type, mapping: ((ViewModelMapping<T, T.ModelType>) -> Void)? = nil) where T : UIView, T : ModelTransfer
  • Undocumented

    Declaration

    Swift

    func configure<T>(_ cellClass: T.Type, _ closure: @escaping (T, T.ModelType, IndexPath) -> Void) where T : UITableViewCell, T : ModelTransfer
  • Undocumented

    Declaration

    Swift

    func configureHeader<T>(_ headerClass: T.Type, _ closure: @escaping (T, T.ModelType, Int) -> Void) where T : UIView, T : ModelTransfer
  • Undocumented

    Declaration

    Swift

    func configureFooter<T>(_ footerClass: T.Type, _ closure: @escaping (T, T.ModelType, Int) -> Void) where T : UIView, T : ModelTransfer
  • Undocumented

    Declaration

    Swift

    func configureEvents<T>(for klass: T.Type, _ closure: (T.Type, T.ModelType.Type) -> Void) where T : ModelTransfer
  • Registers closure to be executed when UITableViewDragDelegate.tableView(_:itemsForBeginning:at:) method is called for cellClass.

    Declaration

    Swift

    open func itemsForBeginningDragSession<Cell>(from cellClass: Cell.Type, _ closure: @escaping (UIDragSession, Cell, Cell.ModelType, IndexPath) -> [UIDragItem]) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed when UITableViewDragDelegate.tableView(_:itemsForAddingTo:at:point:) method is called for cellClass

    Declaration

    Swift

    open func itemsForAddingToDragSession<Cell>(from cellClass: Cell.Type, _ closure: @escaping (UIDragSession, CGPoint, Cell, Cell.ModelType, IndexPath) -> [UIDragItem]) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed when UITableViewDragDelegate.tableView(_:dragPreviewParametersForRowAt:) method is called for cellClass

    Declaration

    Swift

    open func dragPreviewParameters<Cell>(for cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> UIDragPreviewParameters?) where Cell : UITableViewCell, Cell : ModelTransfer
  • Registers closure to be executed when UITableViewDragDelegate.tableView(_:dragSessionWillBegin:) method is called.

    Declaration

    Swift

    open func dragSessionWillBegin(_ closure: @escaping (UIDragSession) -> Void)
  • Registers closure to be executed when UITableViewDragDelegate.tableView(_:dragSessionDidEnd:) method is called.

    Declaration

    Swift

    open func dragSessionDidEnd(_ closure: @escaping (UIDragSession) -> Void)
  • Registers closure to be executed when UITableViewDragDelegate.tableView(_:dragSessionAllowsMoveOperation) method is called.

    Declaration

    Swift

    open func dragSessionAllowsMoveOperation(_ closure: @escaping (UIDragSession) -> Bool)
  • Registers closure to be executed when UITableViewDragDelegate.tableView(_:dragSessionIsRestrictedToDraggingApplication:) method is called.

    Declaration

    Swift

    open func dragSessionIsRestrictedToDraggingApplication(_ closure: @escaping (UIDragSession) -> Bool)
  • Registers closure to be executed when UITableViewDropDelegate.tableView(_:performDropWith:) method is called.

    Declaration

    Swift

    open func performDropWithCoordinator(_ closure: @escaping (UITableViewDropCoordinator) -> Void)
  • Registers closure to be executed when UITableViewDropDelegate.tableView(_:canHandle:) method is called.

    Declaration

    Swift

    open func canHandleDropSession(_ closure: @escaping (UIDropSession) -> Bool)
  • Registers closure to be executed when UITableViewDropDelegate.tableView(_:dropSessionDidEnter:) method is called.

    Declaration

    Swift

    open func dropSessionDidEnter(_ closure: @escaping (UIDropSession) -> Void)
  • Registers closure to be executed when UITableViewDropDelegate.tableView(_:dropSessionDidUpdate:withDestination:) method is called.

    Declaration

    Swift

    open func dropSessionDidUpdate(_ closure: @escaping (UIDropSession, IndexPath?) -> UITableViewDropProposal)
  • Registers closure to be executed when UITableViewDropDelegate.tableView(_:dropSessionDidExit:) method is called.

    Declaration

    Swift

    open func dropSessionDidExit(_ closure: @escaping (UIDropSession) -> Void)
  • Registers closure to be executed when UITableViewDropDelegate.tableView(_:dropSessionDidEnd:) method is called.

    Declaration

    Swift

    open func dropSessionDidEnd(_ closure: @escaping (UIDropSession) -> Void)
  • Registers closure to be executed when UITableViewDropDelegate.tableView(_:dropPreviewParametersForRowAt:) method is called.

    Declaration

    Swift

    open func dropPreviewParameters(_ closure: @escaping (IndexPath) -> UIDragPreviewParameters?)
  • Convenience method for dropping item into placeholder. Returns DTTableViewDropPlaceholderContext, which is a replacement for UITableViewDropPlaceholderContext, that automatically handles drop if you are using MemoryStorage. It also automatically dispatches insertion to DispatchQueue.main.

    Declaration

    Swift

    open func drop(_ item: UIDragItem, to placeholder: UITableViewDropPlaceholder,
                   with coordinator: UITableViewDropCoordinator) -> DTTableViewDropPlaceholderContext
  • Registers mapping for cellClass. Mapping will automatically check for nib with the same name as cellClass and register it, if it is found. UITableViewCell can also be designed in storyboard.

    Declaration

    Swift

    open func register<Cell:ModelTransfer>(_ cellClass:Cell.Type,
                                        mapping: ((ViewModelMapping<Cell, Cell.ModelType>) -> Void)? = nil,
                                        handler: @escaping (Cell, Cell.ModelType, IndexPath) -> Void = { _, _, _ in }) where Cell: UITableViewCell

    Parameters

    cellClass

    UITableViewCell subclass type, conforming to ModelTransfer protocol.

    mapping

    mapping configuration closure, executed before any registration or dequeue is performed.

    handler

    configuration closure, that is run when cell is dequeued. Please note, that handler is called before update(with:) method.

  • Registers mapping from modelType to cellClass. Mapping will automatically check for nib with the same name as cellClass and register it, if it is found. UITableViewCell can also be designed in storyboard.

    Declaration

    Swift

    open func register<Cell: UITableViewCell, Model>(_ cellClass: Cell.Type, for modelType: Model.Type,
                                                     mapping: ((ViewModelMapping<Cell, Model>) -> Void)? = nil,
                                                     handler: @escaping (Cell, Model, IndexPath) -> Void)

    Parameters

    cellClass

    UITableViewCell to register

    modelType

    Model type, which is mapped to cellClass.

    mapping

    mapping configuration closure, executed before any registration or dequeue is performed.

    handler

    configuration closure, that is run when cell is dequeued.

  • Registers mapping from model class to header view of headerClass type.

    Method will automatically check for nib with the same name as headerClass. If it exists - nib will be registered instead of class. This method also sets TableViewConfiguration.sectionHeaderStyle property to .view.

    Note

    Views does not need to be UITableViewHeaderFooterView, if it’s a UIView subclass, it also will be created from XIB. In the latter case, events defined inside mapping closure are not supported.

    Note

    handler closure is called before update(with:) method.

    Declaration

    Swift

    open func registerHeader<View:ModelTransfer>(_ headerClass : View.Type,
                                              mapping: ((ViewModelMapping<View, View.ModelType>) -> Void)? = nil,
                                              handler: @escaping (View, View.ModelType, Int) -> Void = { _, _, _ in }) where View: UIView
  • Registers mapping from model class to header view of headerClass type.

    Method will automatically check for nib with the same name as headerClass. If it exists - nib will be registered instead of class. This method also sets TableViewConfiguration.sectionHeaderStyle property to .view.

    Note

    Views does not need to be UITableViewHeaderFooterView, if it’s a UIView subclass, it also will be created from XIB. In the latter case, events defined inside mapping closure are not supported.

    Declaration

    Swift

    open func registerHeader<View: UIView, Model>(_ headerClass : View.Type,
                                                  for: Model.Type,
                                                  mapping: ((ViewModelMapping<View, Model>) -> Void)? = nil,
                                                  handler: @escaping (View, Model, Int) -> Void)
  • Registers mapping from model class to footerView view of footerClass type.

    Method will automatically check for nib with the same name as footerClass. If it exists - nib will be registered instead of class. This method also sets TableViewConfiguration.sectionFooterStyle property to .view.

    Note

    Views does not need to be UITableViewHeaderFooterView, if it’s a UIView subclass, it also will be created from XIB. In the latter case, events defined inside mapping closure are not supported.

    Note

    handler closure is called before update(with:) method.

    Declaration

    Swift

    open func registerFooter<View:ModelTransfer>(_ footerClass: View.Type,
                                              mapping: ((ViewModelMapping<View, View.ModelType>) -> Void)? = nil,
                                              handler: @escaping (View, View.ModelType, Int) -> Void = { _, _, _ in }) where View:UIView
  • Registers mapping from model class to footer view of footerClass type.

    Method will automatically check for nib with the same name as footerClass. If it exists - nib will be registered instead of class. This method also sets TableViewConfiguration.sectionFooterStyle property to .view.

    Note

    Views does not need to be UITableViewHeaderFooterView, if it’s a UIView subclass, it will be created from XIB. In the latter case, events defined inside mapping closure are not supported.

    Declaration

    Swift

    open func registerFooter<View: UIView, Model>(_ footerClass : View.Type,
                                           for: Model.Type,
                                           mapping: ((ViewModelMapping<View, Model>) -> Void)? = nil,
                                           handler: @escaping (View, Model, Int) -> Void)
  • Unregisters cellClass from DTTableViewManager and UITableView.

    Declaration

    Swift

    open func unregister<Cell>(_ cellClass: Cell.Type) where Cell : UITableViewCell, Cell : ModelTransfer
  • Unregisters headerClass from DTTableViewManager and UITableView.

    Declaration

    Swift

    open func unregisterHeader<View>(_ headerClass: View.Type) where View : UIView, View : ModelTransfer
  • Unregisters footerClass from DTTableViewManager and UITableView.

    Declaration

    Swift

    open func unregisterFooter<View>(_ footerClass: View.Type) where View : UIView, View : ModelTransfer