TableViewArrayDataSource
open class TableViewArrayDataSource<CellType: UITableViewCell, Type: Equatable>: ArrayDataSource<Type>, UITableViewDataSource
where CellType: Configurable
Array-based UITableView data source having elements of type Type
and using ConfigurableTableViewCell
.
-
TableView that owns this DataSource.
Declaration
Swift
open let tableView: UITableView
-
Inits the DataSource providing a UITableView and its objects. Assumes the ReuseIdentifier will have the same name as
CellType
type.Declaration
Swift
public convenience init(for tableView: UITableView, with dataProvider: ArrayDataProvider<Type>)
Parameters
for
The target UITableView.
dataProvider
The array-based Data provider.
-
Inits the DataSource providing a UITableView and its objects.
Declaration
Swift
public required init(for tableView: UITableView, reuseIdentifier: @escaping ((IndexPath) -> (String)), with dataProvider: ArrayDataProvider<Type>)
Parameters
for
The target UITableView.
reuseIdentifier
Block used to define the Ruse Identifier based on the given IndexPath.
dataProvider
The array-based Data provider.
-
Propagates through
onRefresh
a refresh for interested objects and also callsreloadData
ontableView
.Declaration
Swift
open override func refresh()
-
Returns the number of rows in its only section. The number of rows always matches the number of contained objects.
Declaration
Swift
open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
Parameters
tableView
The target UITableView.
section
The desired sections. Values different than
0
will result in0
being returned.Return Value
number of objects.
-
Returns the number of rows in its only section. The number of rows always matches the number of contained objects.
Declaration
Swift
open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
Parameters
tableView
The target UITableView.
cellForRowAt
The indexPath for the given object, or
nil
if not found.Return Value
number of objects.