Section
public struct Section
Represents a section of list UI, containing header node, footer node
and collection of cell nodes.
This works as an intermediary for DifferenceKit.
Example for simple section.
Section(
id: 0,
header: Label("Header"),
footer: Label("Footer"),
cells: {
Label("Cell 0")
.identified(by: \.text)
Label("Cell 1")
.identified(by: \.text)
Label("Cell 2")
.identified(by: \.text)
}
)
-
A type-erased identifier that can be used to uniquely identify the section.
Declaration
Swift
public var id: AnyHashable -
A node representing header view.
Declaration
Swift
public var header: ViewNode? -
A collection of nodes representing cells.
Declaration
Swift
public var cells: [CellNode] -
A node representing footer view.
Declaration
Swift
public var footer: ViewNode? -
Create a section wrapping id, header node, footer node and cell nodes.
Declaration
Parameters
idAn identifier to be wrapped.
headerA node for header view.
cellsA collection of nodes for cells.
footerA node for footer view.
-
Create a section wrapping id, header node, footer node and cell nodes.
Note
The nil contained in the collection of cell nodes is removed.
Declaration
Parameters
idAn identifier to be wrapped.
headerA node for header view.
cellsA collection of nodes for cells that can be contains nil.
footerA node for footer view.
-
Build an array of section.
Declaration
Swift
public func buildSections() -> [Section]
-
An identifier value for difference calculation.
Declaration
Swift
@inlinable public var differenceIdentifier: AnyHashable { get } -
The collection of element in the section.
Declaration
Swift
@inlinable public var elements: [CellNode] { get } -
Indicate whether the content of
selfis equals to the content of the given source value.Declaration
Swift
@inlinable public func isContentEqual(to source: Section) -> Bool
View on GitHub
Section Structure Reference