Overview
MessageHeader is a Component that showcases the User or Group details in the toolbar. Furthermore, it also presents a typing indicator and a back navigation button for ease of use.

MessageHeader is comprised of the following components:
Usage
Integration
You can addMessageHeader component directly by setting the user.
Swift
Actions
Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs. TheMessageHeader component does not have any exposed actions.
1. set(onBack:)
Thisset(onBack:) method becomes valuable when a user needs to override the action triggered upon pressing the back button in CometChatMessageHeader.
- Swift
2. set(onError:)
This method proves helpful when a user needs to customize the action taken upon encountering an error in CometChatMessageHeader.- Swift
Filters
Filters allow you to customize the data displayed in a list within aComponent. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
The MessageHeader component does not have any exposed filters.
Events
Events are emitted by aComponent. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
The MessageHeader component does not produce any events.
Customization
To fit your app’s design requirements, you can customize the appearance of the conversation component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.Style
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.1. MessageHeader Style
To customize the appearance, you can assign aMessageHeaderStyle object to the MessageHeader component.
Global level styling
- Swift
- Swift

MessageHeaderStyle are as follows:
2. Avatar Style
If you want to apply customized styles to theAvatar component within the MessageHeader Component, you can use the following code snippet. For more information you can refer Avatar Styles.
Global level styling
- Swift
- Swift

Functionality
These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements. Below is a list of customizations along with corresponding code snippetsAdvanced
For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.Date Time Formatter
The CometChatMessageHeader component supports full customization of how date and time are displayed using the CometChatDateTimeFormatter. This enables developers to localize, format, or personalize the date and time strings shown next to the message header such as “Today”, “Yesterday”, “12:45 PM”, etc.- Component-Level (Global)
- Swift
- Instance-Level (Local)
- Swift
Available closures
Each closure receives a timestamp (Int, representing UNIX time) and must return a String representing the formatted time.
SetListItemView
With this function, you can assign a custom ListItem to the message header Component.- Swift

CustomListItemView as a custom UIView. Which we will inflate in setListItemView()
swift
SetLeadingView
You can modify the leading view of a group cell using .set(leadingView:).- Swift

CustomLeadingView as a custom UIView. Which we will inflate in setLeadingView()
- Swift
SetTitleView
You can customize the title view of a group cell using .set(titleView:).- Swift

CustomTitleView as a custom UIView. Which we will inflate in setTitleView()
- Swift
SetTrailView
You can modify the trailing view of a message header using .set(trailView:).- Swift

CustomTrailView as a custom UIView. Which we will inflate in setTrailView()
- Swift
SetSubTitleView
You can customize the subtitle view for each group item to meet your requirements- Swift

CustomSubtitleView UIView file into the .set(subtitleView:) method within CometChatMessageHeader.
- Swift
To ensure that the
MessageHeader is properly configured, passing the controller is mandatory.- Swift