ChatLayoutDelegate

public protocol ChatLayoutDelegate : AnyObject

ChatLayout delegate

  • shouldPresentHeader(_:at:) Default implementation

    ChatLayout will call this method to ask if it should present the header in the current layout.

    Default Implementation

    Default implementation returns: false.

    Declaration

    Swift

    func shouldPresentHeader(_ chatLayout: ChatLayout, at sectionIndex: Int) -> Bool

    Parameters

    chatLayout

    ChatLayout reference.

    sectionIndex

    Index of the section.

    Return Value

    Bool.

  • shouldPresentFooter(_:at:) Default implementation

    ChatLayout will call this method to ask if it should present the footer in the current layout.

    Default Implementation

    Default implementation returns: false.

    Declaration

    Swift

    func shouldPresentFooter(_ chatLayout: ChatLayout, at sectionIndex: Int) -> Bool

    Parameters

    chatLayout

    ChatLayout reference.

    sectionIndex

    Index of the section.

    Return Value

    Bool.

  • sizeForItem(_:of:at:) Default implementation

    ChatLayout will call this method to ask what size the item should have.

    Default Implementation

    Default implementation returns: ItemSize.auto.

    Declaration

    Swift

    func sizeForItem(_ chatLayout: ChatLayout, of kind: ItemKind, at indexPath: IndexPath) -> ItemSize

    Parameters

    chatLayout

    ChatLayout reference.

    kind

    Type of element represented by ItemKind.

    indexPath

    Index path of the item.

    Return Value

    ItemSize.

  • alignmentForItem(_:of:at:) Default implementation

    ChatLayout will call this method to ask what type of alignment the item should have.

    Default Implementation

    Default implementation returns: ChatItemAlignment.fullWidth.

    Declaration

    Swift

    func alignmentForItem(_ chatLayout: ChatLayout, of kind: ItemKind, at indexPath: IndexPath) -> ChatItemAlignment

    Parameters

    chatLayout

    ChatLayout reference.

    kind

    Type of element represented by ItemKind.

    indexPath

    Index path of the item.

    Return Value

    ChatItemAlignment.

  • Asks the delegate to modify a layout attributes instance so that it represents the initial visual state of an item being inserted.

    The originalAttributes instance is a reference type, and therefore can be modified directly.

    Default Implementation

    Default implementation sets a ChatLayoutAttributes.alpha to zero.

    Declaration

    Swift

    func initialLayoutAttributesForInsertedItem(_ chatLayout: ChatLayout,
                                                of kind: ItemKind,
                                                at indexPath: IndexPath,
                                                modifying originalAttributes: ChatLayoutAttributes,
                                                on state: InitialAttributesRequestType)
  • Asks the delegate to modify a layout attributes instance so that it represents the final visual state of an item being removed via UICollectionView.deleteSections(_:).

    The originalAttributes instance is a reference type, and therefore can be modified directly.

    Default Implementation

    Default implementation sets a ChatLayoutAttributes.alpha to zero.

    Declaration

    Swift

    func finalLayoutAttributesForDeletedItem(_ chatLayout: ChatLayout,
                                             of kind: ItemKind,
                                             at indexPath: IndexPath,
                                             modifying originalAttributes: ChatLayoutAttributes)