Sections
@available(*, deprecated, message: "Migrate to https://github.com/stanwood/SourceModel_iOS")
open class Sections : DataType
Sections holds an array of DataTypes.
Example: DataSource and Delegate design
let itemsOne = [Item(id: "1"), Item(id: "2")]
let itemsTwo = [Meal(id: "pizza"), Meal(id: "ham")]
let sectionOnce = Stanwoon.Elements<Item>(items: itemsOne)
let sectionTwo = Stanwoon.Elements<Meal>(items: itemsTwo)
self.sections = Stanwood.Sections(items: [sectionOnce, sectionTwo])
self.dataSource = SectionsDataSource(dataObject: self.sections)
self.delegate = SectionsDelegate(dataObject: self.sections)
self.collectionView.dataSource = self.dataSource
self.collectionView.delegate = self.delegate
See also
-
Items of DataType
Declaration
Swift
public typealias Section = DataType & Codable
-
Declaration
Swift
public var sections: [Section]
-
Number of items
Declaration
Swift
open var numberOfItems: Int { get }
-
Sections only supports a single section.
See also
DataType
for multiple section optionDeclaration
Swift
open var numberOfSections: Int { get }
Return Value
current section
-
Initializer of Sections
Declaration
Swift
public init(items: [Section])
Parameters
items
[Section]<Type & Equatable & Codable>
-
Subscript to get an item in row.
See also
Declaration
Swift
open subscript(indexPath: IndexPath) -> Type? { get }
Parameters
indexPath
IndexPath location of an item at row
Return Value
Optional<Type>
-
Returns the cell type at indexPath
Declaration
Swift
open func cellType(forItemAt indexPath: IndexPath) -> Fillable.Type?