ComponentWrapping

@dynamicMemberLookup
public protocol ComponentWrapping : Component

Represents a wrapper of component that forwards all actions to wrapped component. You can easily conform arbitrary type to Component protocol by wrapping component instance.

  • The type of wrapped component.

    Declaration

    Swift

    associatedtype Wrapped : Component
  • The wrapped component instance.

    Declaration

    Swift

    var wrapped: Wrapped { get }
  • subscript(dynamicMember:) Extension method

    Accesses a member of wrapped component with key path.

    Declaration

    Swift

    @inlinable
    subscript<T>(dynamicMember keyPath: KeyPath<Wrapped, T>) -> T { get }
  • reuseIdentifier Extension method

    A string used to identify a element that is reusable. Default is the type name of self.

    Declaration

    Swift

    @inlinable
    var reuseIdentifier: String { get }
  • renderContent() Extension method

    Returns a new instance of Content.

    Declaration

    Swift

    @inlinable
    func renderContent() -> Wrapped.Content

    Return Value

    A new Content instance.

  • render(in:) Extension method

    Render properties into the content.

    Declaration

    Swift

    @inlinable
    func render(in content: Wrapped.Content)
  • referenceSize(in:) Extension method

    Returns the referencing size of content to render on the list UI.

    Note

    Only CGSize.height is used to determine the size of element in UITableView.

    Declaration

    Swift

    @inlinable
    func referenceSize(in bounds: CGRect) -> CGSize?

    Return Value

    The referencing size of content to render on the list UI. If returns nil, the element of list UI falls back to its default size like UITableView.rowHeight or UICollectionViewFlowLayout.itemSize.

  • shouldContentUpdate(with:) Extension method

    Returns a Bool value indicating whether the content should be reloaded.

    Note

    Unlike Equatable, this doesn’t compare whether the two values exactly equal. It’s can be ignore property comparisons, if not expect to reload content.

    Declaration

    Swift

    @inlinable
    func shouldContentUpdate(with next: Self) -> Bool

    Return Value

    A Bool value indicating whether the content should be reloaded.

  • shouldRender(next:in:) Extension method

    Returns a Bool value indicating whether component should be render again.

    Declaration

    Swift

    @inlinable
    func shouldRender(next: Self, in content: Wrapped.Content) -> Bool

    Parameters

    next

    The next value to be compared to the receiver.

    content

    An instance of content laid out on the element.

    Return Value

    A Bool value indicating whether the component should be render again.

  • layout(content:in:) Extension method

    Layout the content on top of element of the list UI.

    Note

    UIView and UIViewController are laid out with edge constraints by default.

    Declaration

    Swift

    @inlinable
    func layout(content: Wrapped.Content, in container: UIView)

    Parameters

    content

    An instance of content to be laid out on top of element.

    container

    A container view to layout content.

  • intrinsicContentSize(for:) Extension method

    The natural size for the passed content.

    Declaration

    Swift

    func intrinsicContentSize(for content: Wrapped.Content) -> CGSize

    Return Value

    A CGSize value represents a natural size of the passed content.

  • contentWillDisplay(_:) Extension method

    Invoked every time of before a component got into visible area.

    Declaration

    Swift

    @inlinable
    func contentWillDisplay(_ content: Wrapped.Content)
  • contentDidEndDisplay(_:) Extension method

    Invoked every time of after a component went out from visible area.

    Declaration

    Swift

    @inlinable
    func contentDidEndDisplay(_ content: Wrapped.Content)