ReusableViewConfiguration

public struct ReusableViewConfiguration<View, Object> : ReusableViewConfiguring

The reusable view configuration can decide if it can configure a given view with an object or not. If matching, it is able to configure the view with the object. It knows the reuse identifier of the cell

Note

Dequeuing a view is not part of configuration.
  • The reuse identifier which will be used to register and deque the cell.

    Declaration

    Swift

    public let reuseIdentifier: String
  • The type of the cell.

    Declaration

    Swift

    public var type: ReusableViewType
  • A block to configure the view with given object at the given index path.

    Declaration

    Swift

    public let configuration: ((View, IndexPath, Object) -> Void)?
  • Creates an instance of ReusableViewConfiguration.

    Declaration

    Swift

    public init(reuseIdentifier: String, type: ReusableViewType = .cell, configuration: ((View, IndexPath, Object) -> Void)?)

    Parameters

    reuseIdentifier

    the reuse identifier for registering & dequeuing views

    type

    the type of the Reusable view

    configuration

    a block to configure the view with given object at the given index path.

  • Configures the given view with at the index path with the given object.

    Declaration

    Swift

    public func configure(_ view: View, at indexPath: IndexPath, with object: Object)

    Parameters

    view

    the view to configure

    indexPath

    index path of the view

    object

    the object which relates to the view

  • The reuse identifier which will be used deque the view.

    Declaration

    Swift

    public func reuseIdentifier(for object: Object) -> String

    Parameters

    object

    the object.

    Return Value

    reuse identifier which fits to object.

Available where View: ReuseIdentifierProviding

Available where View: ConfigurableCell, View.ObjectToConfigure == Object

Available where View: ConfigurableCell & ReuseIdentifierProviding, View.ObjectToConfigure == Object