-
shouldPresentHeader(_:Default implementationat: ) CollectionViewChatLayoutwill 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: CollectionViewChatLayout, at sectionIndex: Int) -> BoolParameters
chatLayoutCollectionViewChatLayoutreference.sectionIndexIndex of the section.
Return Value
Bool. -
shouldPresentFooter(_:Default implementationat: ) CollectionViewChatLayoutwill 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: CollectionViewChatLayout, at sectionIndex: Int) -> BoolParameters
chatLayoutCollectionViewChatLayoutreference.sectionIndexIndex of the section.
Return Value
Bool. -
sizeForItem(_:Default implementationof: at: ) CollectionViewChatLayoutwill call this method to ask what size the item should have.NB:
If you are trying to speed up the layout process by returning exact item sizes in this method - do not forget to change
UICollectionReusableView.preferredLayoutAttributesFitting(...)method and do not callsuper.preferredLayoutAttributesFitting(...)there as it will measure theUIViewusing Autolayout Engine anyway.Default Implementation
Default implementation returns:
ItemSize.auto.Declaration
Swift
func sizeForItem(_ chatLayout: CollectionViewChatLayout, of kind: ItemKind, at indexPath: IndexPath) -> ItemSizeParameters
chatLayoutCollectionViewChatLayoutreference.kindType of element represented by
ItemKind.indexPathIndex path of the item.
Return Value
-
alignmentForItem(_:Default implementationof: at: ) CollectionViewChatLayoutwill 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: CollectionViewChatLayout, of kind: ItemKind, at indexPath: IndexPath) -> ChatItemAlignmentParameters
chatLayoutCollectionViewChatLayoutreference.kindType of element represented by
ItemKind.indexPathIndex path of the item.
Return Value
-
initialLayoutAttributesForInsertedItem(_:Default implementationof: at: modifying: on: ) Asks the delegate to modify a layout attributes instance so that it represents the initial visual state of an item being inserted.
The
originalAttributesinstance is a reference type, and therefore can be modified directly.Default Implementation
Default implementation sets a
ChatLayoutAttributes.alphato zero.Declaration
Swift
func initialLayoutAttributesForInsertedItem(_ chatLayout: CollectionViewChatLayout, of kind: ItemKind, at indexPath: IndexPath, modifying originalAttributes: ChatLayoutAttributes, on state: InitialAttributesRequestType) -
finalLayoutAttributesForDeletedItem(_:Default implementationof: at: modifying: ) 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
originalAttributesinstance is a reference type, and therefore can be modified directly.Default Implementation
Default implementation sets a
ChatLayoutAttributes.alphato zero.Declaration
Swift
func finalLayoutAttributesForDeletedItem(_ chatLayout: CollectionViewChatLayout, of kind: ItemKind, at indexPath: IndexPath, modifying originalAttributes: ChatLayoutAttributes) -
interItemSpacing(_:Default implementationof: after: ) Returns the interval between items. If returns
nil- the value fromChatLayoutSettingswill be used.Default Implementation
Default implementation returns:
nil.Declaration
Swift
func interItemSpacing(_ chatLayout: CollectionViewChatLayout, of kind: ItemKind, after indexPath: IndexPath) -> CGFloat? -
interSectionSpacing(_:Default implementationafter: ) Returns the interval between sections. If returns
nil- the value fromChatLayoutSettingswill be used.Default Implementation
Default implementation returns:
nil.Declaration
Swift
func interSectionSpacing(_ chatLayout: CollectionViewChatLayout, after sectionIndex: Int) -> CGFloat?
ChatLayoutDelegate Protocol Reference