Protocols

The following protocols are available globally.

  • Convenient optional protocol for layout implementations to use instead of Layout.

    It requires a more typesafe configure(view:) method that is used to implement configure(baseViewType:) in the Layout protocol.

    See more

    Declaration

    Swift

    public protocol ConfigurableLayout: Layout
  • A protocol for types that layout view frames.

    Basic layouts

    Many UIs can be expressed by composing the basic layouts that LayoutKit provides:

    If your UI can not be expressed by composing these basic layouts, then you can create a custom layout. Custom layouts are recommended but not required to conform to the ConfigurableLayout protocol due to the type safety and default implementation that it adds.

    Layout algorithm

    Layout is performed in two steps:

    1. measurement(within:)
    2. arrangement(within:measurement:).

    arrangement(origin:width:height:) is a convenience method for doing both passes in one function call.

    Threading

    Layouts MUST be thread-safe.

    See more

    Declaration

    Swift

    public protocol Layout
  • A view that can be reloaded with data.

    UITableView and UICollectionView conform to this protocol.

    See more

    Declaration

    Swift

    public protocol ReloadableView: class