Protocol

UIDataSourceTranslating

An advanced interface for managing a data source object.

Declaration

protocol UIDataSourceTranslating

Overview

Use the methods of this protocol to map between the positions of items and sections in your data source object and the positions of those same items and sections in your presented layout. Objects that adopt this protocol do so because the position of items in their data source object do not always match the corresponding positions in their presented layout.

UITableView and UICollectionView adopt this protocol and use it in conjunction with drag and drop operations. For example, UITableView must account for the presence of placeholder cells, which appear as rows in the table but do not have a corresponding entry in the data source object. Typically, you do not adopt this protocol in your own classes.

Topics

Item Positions

func presentationIndexPath(forDataSourceIndexPath: IndexPath?) -> IndexPath?

Translate an index in your data source object to the equivalent index in your presented layout.

Required.

func dataSourceIndexPath(forPresentationIndexPath: IndexPath?) -> IndexPath?

Translate an index in your your presented layout to the equivalent index in your data source object.

Required.

Section Positions

func presentationSectionIndex(forDataSourceSectionIndex: Int) -> Int

Translate a section index in your data source object to the equivalent section index in your presented layout.

Required.

func dataSourceSectionIndex(forPresentationSectionIndex: Int) -> Int

Translate a section index in your your presented layout to the equivalent section index in your data source object.

Required.

Action Execution

func performUsingPresentationValues(() -> Void)

Execute actions on the current object using index paths that are relative to the presentation layer of that object.

Required.

Relationships

Inherits From

Conforming Types

See Also

Drag and Drop

Supporting Drag and Drop in Collection Views

Initiate drags and handle drops from a collection view.

protocol UICollectionViewDragDelegate

The interface for initiating drags from a collection view.

protocol UICollectionViewDropDelegate

The interface for handling drops in a collection view.

protocol UICollectionViewDropCoordinator

An interface for coordinating your custom drop-related actions with the collection view.

class UICollectionViewDropProposal

Your proposed solution for handling a drop in a collection view.

protocol UICollectionViewDropItem

The data associated with an item being dropped into the collection view.

protocol UICollectionViewDropPlaceholderContext

An object that contains information about a placeholder in the collection view.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software