AI Integration Quick Reference
AI Integration Quick Reference
User objects.
Get the Logged-In User
UsegetLoggedInUser() to get the current user’s details. Returns nil if no user is logged in.
- Swift
- Objective C
User object containing all the information related to the logged-in user.
Retrieve List of Users
UseUsersRequestBuilder to fetch users with filtering, searching, and pagination.
Set Limit
Sets the number of users to fetch per request.- Swift
Set Search Keyword
Filters users by a search string.- Swift
Search In
Specifies which user properties to search. Works withset(searchKeyword:). By default, searches both UID and name.
- Swift
Set Status
Filters users by online status:CometChat.UserStatus.online— Only online usersCometChat.UserStatus.offline— Only offline users
- Swift
Hide Blocked Users
Whentrue, excludes users blocked by the logged-in user from the results.
- Swift
Set Roles
Filters users by specified roles.- Swift
Friends Only
Whentrue, returns only friends of the logged-in user.
- Swift
Set Tags
Filters users by specified tags.- Swift
With Tags
Whentrue, includes tag data in the returned user objects.
- Swift
Set UIDs
Fetches specific users by their UIDs. Maximum 25 users per request.- Swift
Sort By
Sorts the user list by a specific property. Default sort order:status → name → UID. Pass "name" to sort by name → UID.
- Swift
Sort By Order
Sets the sort order. Default is ascending. Use.desc for descending.
- Swift
build() to get the UsersRequest object, then call fetchNext() to retrieve users.
- Swift
- Objective C
Retrieve Particular User Details
UsegetUser() to fetch a specific user’s details by UID.
- Swift
- Objective C
| Parameter | Description |
|---|---|
| UID | The UID of the user for whom the details are to be fetched. |
User object containing the details of the user.
Next Steps
User Presence
Track and subscribe to user online/offline status
Block Users
Block and unblock users from your application
User Management
Create, update, and delete users programmatically
Retrieve Conversations
Fetch conversation lists for your chat UI