Overview
CometChatMessageBubble is the reusable component which forms different types of message bubbles accordingly.
Components
CometChatMessageBubble contains below component in it.
- Leading View
- Header View
- FooterView
- ContainerView
- BubbleView
Methods
Leading View
The avatar is aUIImageView that specifies an avatar for MessageBubble. You can modify the title using the below methods:
| Method | Description |
|---|---|
set(avatarName: String) | Sets the avatar initials for MessageBubble. |
set(avatarURL: String) | Sets the avatar image with given URL for MessageBubble. |
set(avatarStyle: AvatarStyle) | styles the avatar in MessageBubble |
hide(leadingView: Bool) | Hide/shows the avatar in MessageBubble |
- Swift
Set Avatar Style
User can style the avatar component in message bubble with the help of properties provided by theAvatarStyle.
| Method | Description |
|---|---|
set(background: UIColor) | Sets the background color for Avatar |
set(cornerRadius: CometChatCornerStyle) | Sets the corner radius for Avatar |
set(borderWidth: CGFloat) | Sets the border width for Avatar |
set(borderColor: UIColor) | Sets the border color for Avatar |
set(textFont: UIFont) | Sets the text font for Avatar |
set(textColor: UIColor) | Sets the text color for Avatar |
set(outerViewWidth: CGFloat) | Sets the outerView width for Avatar |
set(outerViewSpacing: CGFloat) | Sets the outerView spacing for Avatar |
- Swift
Controller
This method will set the instance of the view controller from which theMessageBubble is presented.
| Method | Description |
|---|---|
set(controller: UIViewController) | This method will set the instance of the view controller from which the MessageBubble is presented. |
- Swift
Message Bubble Alignment
This method will set the alignment for the **MessageBubble .**This will take the MessageBubbleAlignment as a enum and render the alignment of the MessageBubble.
MessageBubbleAlignment has two cases:
1. Left
2. Right
| Method | Description |
|---|---|
set(bubbleAlignment: MessageBubbleAlignment) | This method will set the alignment for the **MessageBubble .**This will take the MessageBubbleAlignment as a enum and render the alignment of the MessageBubble. MessageBubbleAlignment has two cases: .left, .right |
- Swift
Setup Views
You can pass multiple views in the MessageBubble| Method | Description |
|---|---|
set(headerView: UIStackView) | This will set the header view in the MessageBubble |
hide(headerView: Bool) | This will hide/show the header view in the MessageBubble |
set(footerView: UIStackView) | This will set the footer view in the MessageBubble |
hide(footerView: Bool) | This will hide/show the header view in the MessageBubble |
set(bubbleView: UIStackView?) | This will set the bubble view in the MessageBubble |
set(replyView: UIStackView) | This will set the reply view in the MessageBubble |
- Swift
Set MessageBubbleStyle
User can style theMessageBubble with the help of properties provided by the MessageBubbleStyle.
| Method | Description |
|---|---|
set(background: UIColor) | Sets the background color for ListItem |
set(cornerRadius: CometChatCornerStyle) | Sets the corner radius for ListItem |
set(borderWidth: CGFloat) | Sets the border width for ListItem |
set(borderColor: UIColor) | Sets the border color for ListItem |
- Swift