Components | Description |
---|---|
ListBase | a reusable container component having title, search box, customisable background and a List View |
ListItem | a component that renders data obtained from a User object on a Tile having a title, subtitle, leading and trailing view |
CometChatUsers
is a custom view controller, it can be launched directly by user actions such as button clicks or other interactions. It’s also possible to integrate it into a tab view controller. CometChatUsers
offers several parameters and methods for UI customization.
onSelection
event is triggered, it furnishes the list of selected users. This event can be invoked by any button or action within the interface. You have the flexibility to implement custom actions or behaviors based on the selected users.
This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
setOnItemClick
method is used to override the onClick behavior in CometChatUsers. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
setOnBack
, providing customization options for handling the back action.
By default, this action has a predefined behavior: it simply dismisses the current view controller. However, the flexibility of CometChat UI Kit allows you to override this standard behavior according to your application’s specific requirements. You can define a custom action that will be performed instead when the back button is pressed.
setOnError
, allows users to override error handling within CometChatUsers, providing greater control over error responses and actions.
setOnItemLongClick
, empowers users to customize long-click actions within CometChatUsers, offering enhanced functionality and interaction possibilities.
Methods | Type | Description |
---|---|---|
setLimit | int | sets the number users that can be fetched in a single request, suitable for pagination |
setSearchKeyword | String | used for fetching users matching the passed string |
hideBlockedUsers | bool | used for fetching all those users who are not blocked by the logged in user |
friendsOnly | bool | used for fetching only those users in which logged in user is a member |
setRoles | [String] | used for fetching users containing the passed tags |
setTags | [String] | used for fetching users containing the passed tags |
withTags | bool | used to fetch tags data along with the list of users. |
setStatus | CometChat.UserStatus | used for fetching users by their status online or offline |
setUIDs | [String] | used for fetching users containing the passed users |
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.
To handle events supported by Users you have to add corresponding listeners by using CometChatUserEvents
Events | Description |
---|---|
emitOnUserBlock | This will get triggered when the logged in user blocks another user |
emitOnUserUnblock | This will get triggered when the logged in user unblocks another user |
UsersStyle
to the Users Component to customize the styling.
Property | Description | Code |
---|---|---|
Background | Used to set the background color | .set(background: UIColor) |
BorderWidth | Used to set border width | .set(borderWidth: CGFloat) |
BorderColor | Used to set border color | .set(borderColor: UIColor) |
CornerRadius | Used to set border radius | .set(cornerRadius: CometChatCornerStyle) |
BackIconTint | Used to set the color of the back icon in the app bar | .set(backIconTint: UIColor) |
SearchBackground | Used to set the background color of the search box | .set(searchBackgroundColor: UIColor) |
SearchBorderRadius | Used to set the border radius of the search box | .set(searchBorderRadius: CometChatCornerStyle) |
SearchIconTint | Used to set the color of the search icon in the search box | .set(searchIconTint: UIColor) |
SearchBorderWidth | Used to set the border width of the search box | .set(searchBorderWidth: CGFloat) |
OnlineStatusColor | Used to set the color of the status indicator shown if a group member is online | .set(onlineStatusColor: UIColor) |
BackIconTint | Used to set the back icon tint color for Users | .set(backIconTint: UIColor) |
SearchCancelButtonTint | Used to set the search cancel icon tint for Users | .set(searchCancelButtonTint: UIColor) |
SearchPlaceholderFont | Used to set the search placeholder font for Users | .set(searchPlaceholderFont: UIFont) |
SearchPlaceholderColor | Used to set the search placeholder color for Users | .set(searchPlaceholderColor: UIColor) |
LargeTitleColor | Used to set the large title color for Users | .set(largeTitleColor: UIColor) |
LargeTitleFont | Used to set the large title font for Users | .set(largeTitleFont: UIFont) |
SearchTextColor | Used to set the search text color for Users | .set(searchTextColor: UIColor) |
TitleColor | Used to set the title color for Users | .set(titleColor: UIColor) |
TitleFont | Used to set the title font for Users | .set(titleFont: UIFont) |
Avatar
component in the Users Component, you can use the following code snippet. For further insights on Avatar
Styles refer
Property | Description | Code |
---|---|---|
Set Title | Used to set title in the app | .set(title: String, mode: UINavigationItem.LargeTitleDisplayMode) |
Set SearchPlaceholderText | Used to set search placeholder text | .set(searchPlaceholder: String) |
Show BackButton | Used to toggle visibility for back button | .show(backButton: Bool) |
Set SearchIcon | Used to set search Icon in the search field | .set(searchIcon: UIImage?) |
Hide Search | Used to toggle visibility for search box | .hide(search: Bool) |
Hide Error Text | Used to hide error text on fetching users | .hide(errorText: Bool) |
Hide Separator | Used to hide the divider separating the user items | .hide(separator: Bool) |
Disable UsersPresence | Used to control visibility of user indicator shown if user is online | .disable(userPresence: Bool) |
EmptyState Text | Used to set a custom text response when fetching the users has returned an empty list | .set(emptyStateText: String) |
ErrorState Text | Used to set a custom text response when some error occurs on fetching the list of users | .set(errorStateText: String) |
Loading StateView Style | Used to set size of loading view icon while fetching the list of users | .set(loadingStateView: UIActivityIndicatorView.Style) |
Custom_User_ListItem_View
for more complex or unique list items.
Afterwards, seamlessly integrate this Custom_User_ListItem_View
UIView file into the .setListItemView
method within CometChatUsers().
custom_user_subtitleview
for more complex or unique list items.
Afterwards, seamlessly integrate this custom_user_subtitleview
UIView file into the .setSubtitle
method within CometChatUsers().
EmptyStateView
using setEmptyStateView
to match the empty view of your app.
Empty_View
, you can set it as the empty state view by passing it as a parameter to the setEmptyView()
method.
ErrorStateView
using setErrorStateView
to match the error view of your app.
error_view
UIView file, designed to improve user interaction during error states. Simply select the view of your preference and pass it to the .set(errorView: errorView)
method for seamless integration.