Overview
GroupsWithMessages is a Composite Component encapsulating functionalities from the Groups and Messages components. Serving as a versatile wrapper, it seamlessly integrates with CometChatMessages, enabling users to open the module by clicking on any group within the list. This component inherits the behavior of Groups, fostering consistency and familiarity in user interactions.

| Components | Description |
|---|---|
| Groups | The Groups component is designed to display a list of Groups. This essentially represents the recent conversation history. |
| Messages | The Messages component is designed to manage the messaging interaction for Group's conversations. |
Usage
Integration
AsGroupsWithMessages is a view controller, it can be effortlessly added directly in response to a button click or any event. Leveraging all the customizable properties and methods inherited from Groups, this component offers seamless integration and extensive customization capabilities. This makes it a versatile solution for enhancing user interaction within your application.
- Swift
If you are already using a navigation controller, you can use the pushViewController function instead of presenting the view controller.
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.1. SetOnItemClick
This method proves valuable when users seek to override onItemClick functionality within GroupsWithMessages, empowering them with greater control and customization options. ThesetOnItemClick action doesn’t have a predefined behavior. You can override this action using the following code snippet.
- Swift
2. SetOnItemLongClick
This method becomes invaluable when users seek to override long-click functionality within GroupsWithMessages, offering them enhanced control and flexibility in their interactions. ThesetOnItemLongClick action doesn’t have a predefined behavior. You can override this action using the following code snippet.
- Swift
3. SetOnError
You can customize this behavior by using the provided code snippet to override theOn Error and improve error handling.
- Swift
4. SetOnBack
Enhance your application’s functionality by leveraging theSetOnBack feature. This capability allows you to customize the behavior associated with navigating back within your app. Utilize the provided code snippet to override default behaviors and tailor the user experience according to your specific requirements.
- Swift
Filters
Filters allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK. While the GroupsWithMessages component does not have filters, its components do, For more detail on individual filters of its component refer to Groups Filters and Messages Filters. By utilizing the Configurations object of its components, you can apply filters. In the following example, we are applying a filter to the Group List based on only joined groups and setting the limit to 3 using thegroupsRequestBuilder.
- Swift
Swift
If you are already using a navigation controller, you can use the pushViewController function instead of presenting the view controller.
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 GroupsWithMessages does not produce any events but its component does.
Customization
To fit your app’s design requirements, you have the ability to customize the appearance of the GroupsWithMessages 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. GroupsWithMessages Style 🛑
You can set thegroupsWithMessagesStyle to the GroupsWithMessages Component to customize the styling.
- Swift
Swift
If you are already using a navigation controller, you can use the pushViewController function instead of presenting the view controller.
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. The GroupsWithMessages component currently does not offer any available functionality.Components
Nearly all functionality customizations available for a Component are also available for the composite component. Using Configuration, you can modify the properties of its components to suit your needs. You can find the list of all Functionality customization of individual components in Groups and Messages. Example- Swift
Swift
Ensure to pass and present
cometChatGroupsWithMessages. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.Advanced
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 own views, layouts, and UI elements and then incorporate those into the component. By utilizing the Configuration object of each component, you can apply advanced-level customizations to the GroupsWithMessages. Example.set(groupsConfiguration: groupsConfiguration) method when initializing the CometChatGroupsWithMessages instance.
- GroupsWithMessages utilizes the SetMenu function of the
Groupssubcomponent to navigate the user from Groups to Messages

- GroupsWithMessages utilizes the SetMenu function of the
Messagessubcomponent to navigate the user from Messages to Details.

When you override
.setMenu(), the default behavior of GroupsWithMessages will also be overridden.Configurations
Configurations offer the ability to customize the properties of each component within a Composite Component. GroupsWithMessages hasGroups and Messages component. Hence, each of these components will have its individual `Configuration“.
Configurationsexpose properties that are available in its individual components.
Groups
You can customize the properties of the Groups component by making use of thegroupsConfiguration. You can accomplish this by employing the groupsConfiguration props as demonstrated below:
- Swift
GroupsConfiguration can be found under Groups. Properties marked with the symbol are not accessible within the Configuration Object.
Example
Let’s say you want to change the style of the Groups subcomponent and, in addition, you only want to display the Group List based on only joined groups and setting the limit to 3.
You can modify the style using the groupsStyle property and filter the list with the groupsRequestBuilder property.
- Swift
Messages
You can customize the properties of the Messages component by making use of the messagesConfiguration. You can accomplish this by employing themessagesConfiguration props as demonstrated below:
- Swift
MessagesConfiguration can be found under Messages. Properties marked with the symbol are not accessible within the Configuration Object.
Example
Let’s say you want to change the style of the Messages subcomponent and, in addition, you only want to hide message header.
You can modify the style using the messagesStyle property and hide the message header with the hideMessageHeader property.
- Swift
Ensure to pass and present
cometChatGroupsWithMessages. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.Join Group
You can customize the properties of the Join Group component by making use of the JoinGroupConfiguration. You can accomplish this by employing thejoinGroupConfiguration props as demonstrated below:
- Swift
JoinGroupConfiguration can be found under Join Group. Properties marked with the symbol are not accessible within the Configuration Object.
Example
Let’s say you want to change the style of the Join Group subcomponent.
You can modify the style using the joinGroupStyle property.
- Swift
Ensure to pass and present
cometChatGroupsWithMessages. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.Create Group
You can customize the properties of the Create Group component by making use of the CreateGroupConfiguration. You can accomplish this by employing thecreateGroupConfiguration props as demonstrated below:
- Swift
CreateGroupConfiguration can be found under Create Group. Properties marked with the symbol are not accessible within the Configuration Object.
Example
Let’s say you want to change the style of the Create Group subcomponent.
You can modify the style using the createGroupStyle property.
- Swift
Ensure to pass and present
cometChatGroupsWithMessages. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.