CometChatGroups
functions as a standalone component designed to create a screen displaying a list of groups, with the added functionality of enabling users to search for specific groups. Acting as a container component, CometChatGroups encapsulates and formats the CometChatListBase
and CometChatGroupList
components without introducing any additional behavior of its own.
Groups
component is composed of the following BaseComponents:
Components | Description |
---|---|
CometChatListBase | CometChatListBase serves as a container component equipped with a title (navigationBar), search functionality (search-bar), background settings, and a container for embedding a list view. |
CometChatListItem | This component renders information extracted from a Group object onto a tile, featuring a title, subtitle, leading view, and trailing view. |
pushViewController
function instead of presenting the view controller.setOnItemClick
action doesn’t have a predefined behavior. You can override this action using the following code snippet.
setOnItemLongClick
action doesn’t have a predefined behavior. You can override this action using the following code snippet.
On Error
and improve error handling.
SetOnBack
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.
Methods | Type | Description |
---|---|---|
setLimit | Int | Configure the maximum number of groups to fetch in a single request, optimizing pagination for smoother navigation. |
setSearchKeyword | String | Employed to retrieve groups that match the provided string, facilitating precise searches. |
joinedOnly | boolean | Exclusively fetches joined groups. |
setTags | [String] | Utilized to fetch groups containing the specified tags. |
withTags | boolean | Utilized to retrieve groups with specific tags. |
Component
. 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 list of events emitted by the Groups component is as follows.
Event | Description |
---|---|
onGroupCreate | This gets triggered when the logged in user creates a group. |
onGroupDelete | This gets triggered when the logged in user deletes a group. |
onGroupMemberLeave | This gets triggered when the logged in user leaves a group. |
onGroupMemberChangeScope | This gets triggered when the logged in user changes the scope of another group member. |
onGroupMemberBan | This gets triggered when the logged in user bans a group member from the group. |
onGroupMemberKick | This gets triggered when the logged in user kicks another group member from the group. |
onGroupMemberUnban | This gets triggered when the logged in user unbans a user banned from the group. |
onGroupMemberJoin | This gets triggered when the logged in user joins a group. |
onGroupMemberAdd | This gets triggered when the logged in user adds new members to the group. |
onOwnershipChange | This gets triggered when the logged in user transfers the ownership of their group to some other member. |
CometChatGroupsEvents
Listener’s
CometChatGroupsEvents
Listener’s
Property | Description | Code |
---|---|---|
Background | Sets the background color | .set(background: UIColor) |
CornerRadius | Sets the corner radius | .set(cornerRadius: CometChatCornerStyle) |
BorderWidth | Sets the border width | .set(borderWidth: CGFloat) |
TitleColor | Sets the title color | .set(titleColor: UIColor) |
TitleFont | Sets the title font | .set(titleFont: UIFont) |
LargeTitleColor | Sets the large title color | .set(largeTitleColor: UIColor) |
LargeTitleFont | Sets the large title font | .set(largeTitleFont: UIFont) |
BackIconTint | Sets the back button tint color | .set(backIconTint: UIColor) |
SearchIconTint | Sets the search icon tint color | .set(searchIconTint: UIColor) |
SearchTextFont | Sets the search text font | .set(searchTextFont: UIFont) |
SearchTextColor | Sets the search text color | .set(searchTextColor: UIColor) |
SearchCancelButtonTint | Sets the search cancel icon tint | .set(searchCancelButtonTint: UIColor) |
SearchPlaceholderFont | Sets the search placeholder font | .set(searchPlaceholderFont: UIFont) |
SearchPlaceholderColor | Sets the search placeholder color | .set(searchPlaceholderColor: UIColor) |
PrivateGroupIconBackgroundColor | Sets the private group icon background | .set(privateGroupIconBackgroundColor: UIColor) |
ProtectedGroupIconBackgroundColor | Sets the protected group icon background | .set(protectedGroupIconBackgroundColor: UIColor) |
Avatar
component in the Groups Component, you can use the following code snippet. For further insights on Avatar
Styles refer
ListItemStyle
component in the Groups
Component, you can use the following code snippet. For further insights on ListItemStyle
Styles refer
Property | Description | Code |
---|---|---|
title | Used to set title | set(title:String, mode:UINavigationItem.LargeTitleDisplayMode ) |
searchPlaceholderText | Used to set search placeholder text | set(searchPlaceholder: String) |
errorStateText | Used to set a custom text response when some error occurs on fetching the list of groups | .set(errorStateText: String) |
emptyStateText | Used to set a custom text response when fetching the groups has returned an empty list | .set(emptyStateText: String) |
searchIcon | Used to set search Icon in the search field | .set(searchIcon: UIImage?) |
privateGroupIcon | Used to set the private group Icon | .set(privateGroupIcon: UIImage) |
protectedGroupIcon | Used to set the protected group Icon | .set(protectedGroupIcon: UIImage) |
hideSearch | Used to toggle visibility for search box | .hide(search: Bool) |
hideErrorText | Used to hide error on fetching groups | .hide(errorText: Bool) |
hideSeparator | Used to hide the divider separating the user items | .hide(separator: Bool) |
backButtonTitle | Used to set back button title | .set(backButtonTitle: String?) |
selectionMode | set the number of groups that can be selected, SelectionMode can be single, multiple or none. | .selectionMode(mode: SelectionMode) |
CustomListItemGroupView
and pass it inside the setListItemView()
method.
CometChatGroups
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller..setSubtitleView()
method. But keep in mind, by using this you will override the default Subtitle view functionality.
Custom_Subtitle_Group_View
a UIView file.
CometChatGroups
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller..set(emptyView: UIView)
to match the empty view of your app.
Custom_Empty_State_GroupView
a UIView file.
CometChatGroups
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller..set(errorView: UIView)
to match the error view of your app.
Custom_ErrorState_GroupView
and pass it inside the .set(errorView: UIView)
method.
CometChatGroups
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.CometChatGroups
, enhancing its interface with a personalized menu
for a more user-friendly experience.
CometChatGroups
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.