AbstractTableDataSource

@available(*, deprecated, message: "Migrate to `TableDataSource` https://github.com/stanwood/SourceModel_iOS")
open class AbstractTableDataSource : NSObject, UITableViewDataSource, TableDataSource, DataSourceType

The AbstractTableDataSource conforms to the TableDataSource protocol and implements AbstractTableDataSource.numberOfSections(in:) and AbstractTableDataSource.tableView(_:numberOfRowsInSection:). It midiates the application data model DataType and Type for the UITableView.

It is requried to subclass AbstractTableDataSource and override AbstractTableDataSource.tableView(_:cellForRowAt:)

Example: DataSource and Delegate design
let items = [Element(id: "1"), Element(id: "2")]
self.objects = Stanwood.Elements<Element>(items: items)

self.dataSource = ElementDataSource(dataType: objects)
self.delegate = ElementDelegate(dataType: objects)

self.tableView.dataSource = self.dataSource
self.tableView.delegate = self.delegate

See also

AbstractCollectionDelegate

Objects

DataType

Type

  • dataType, a collection of types

    Declaration

    Swift

    public internal(set) var dataType: DataType? {
      get
      }
  • A single type object to present

    Declaration

    Swift

    public internal(set) var type: Type? {
      get
      }
  • Initialise with a collection of types

    See also

    DataType

    Declaration

    Swift

    public init(dataType: DataType?, delegate: AnyObject? = nil)

    Parameters

    dataType

    dataType

    delegate

    Optional AnyObject delegate

  • Initialise with a a single type object.

    See also

    Type

    Declaration

    Swift

    public init(type: Type)

    Parameters

    dataType

    DataType

  • update current dataSource with dataType.

    Note: If data type is a class, it is not reqruied to update the dataType.

    See also

    Type

    Declaration

    Swift

    open func update(with dataType: DataType?)

    Parameters

    dataType

    DataType

  • update current dataSource with dataType.

    Note: If data type is a class, it is not reqruied to update the dataType.

    See also

    DataType

    Declaration

    Swift

    open func update(with type: Type?)

    Parameters

    dataType

    Type