DataSource
public struct DataSource<Item>
extension DataSource: DataSourceProtocol
A DataSource is a concrete DataSourceProtocol.
It represents a collection of section-based data.
-
The sections in the data source.
Declaration
Swift
public var sections: [Section<Item>]
-
Inserts the item at the specified index path.
Declaration
Swift
public mutating func insert(item: Item, at indexPath: IndexPath)Parameters
itemThe item to be inserted.
indexPathThe index path specifying the location for the item.
-
Inserts the item at the specified row and section.
Declaration
Swift
public mutating func insert(item: Item, atRow row: Int, inSection section: Int)Parameters
itemThe item to be inserted.
rowThe row location for the item.
sectionThe section location for the item.
-
Appends the item at the specified section.
Declaration
Swift
public mutating func append(_ item: Item, inSection section: Int)Parameters
itemThe item to be appended.
sectionThe section location for the item.
-
Removes the item at the specified row and section.
Declaration
Swift
@discardableResult public mutating func remove(atRow row: Int, inSection section: Int) -> Item?Parameters
rowThe row location of the item.
sectionThe section location of the item.
Return Value
The item removed, or
nilif it does not exist. -
Removes the item at the specified index path.
Declaration
Swift
@discardableResult public mutating func remove(at indexPath: IndexPath) -> Item?Parameters
indexPathThe index path specifying the location of the item.
Return Value
The item at
indexPath, ornilif it does not exist.
-
Declaration
Swift
public subscript(index: Int) -> Section<Item> { get set }Parameters
indexThe index of a section.
Return Value
The section at
index. -
Declaration
Swift
public subscript(indexPath: IndexPath) -> Item { get set }Parameters
indexPathThe index path of an item.
Return Value
The item at
indexPath.
View on GitHub
DataSource Structure Reference