CellNode

public struct CellNode

The node for cell that can be uniquely identified. Wrapping type-erased identifier and component. This works as an intermediary for DifferenceKit.

  • id

    A type-erased identifier that can be used to uniquely identify the component.

    Declaration

    Swift

    public var id: AnyHashable
  • A type-erased component which wrapped in self.

    Declaration

    Swift

    public var component: AnyComponent
  • Create a node wrapping given id and component.

    Declaration

    Swift

    @inlinable
    public init<I, C>(id: I, _ component: C) where I : Hashable, C : Component

    Parameters

    id

    An identifier to be wrapped.

    component

    A component to be wrapped.

  • Create a node wrapping given component and its id.

    Declaration

    Swift

    @inlinable
    public init<C>(_ component: C) where C : IdentifiableComponent
  • Returns a base instance of component casted as given type if possible.

    Declaration

    Swift

    @inlinable
    public func component<T>(as _: T.Type) -> T?

    Return Value

    A casted base instance.

  • Declaration

    Swift

    public func buildCells() -> [CellNode]
  • An identifier value for difference calculation.

    Declaration

    Swift

    @inlinable
    public var differenceIdentifier: AnyHashable { get }
  • Indicate whether the content of self is equals to the content of the given source value.

    Declaration

    Swift

    @inlinable
    public func isContentEqual(to source: CellNode) -> Bool
  • A textual representation of this instance, suitable for debugging.

    Declaration

    Swift

    @inlinable
    public var debugDescription: String { get }