Skip to main content
Build a user profile screen with avatar display, messaging, audio/video calls, and block/unblock functionality using CometChat UIKit.

Prerequisites

Before implementing this feature, ensure you have:
  • Completed Getting Started setup
  • CometChat UIKit v5+ installed
  • User logged in with CometChatUIKit.login()
  • Navigation controller configured

Overview

The user details screen provides:
  • Profile Display - Avatar, name, and online status
  • Messaging - Start one-on-one chats
  • Calling - Audio and video call buttons
  • Block/Unblock - Manage user relationships
  • Delete Conversation - Remove chat history

Basic Implementation

Create a simple user details screen:

Production Implementation

Complete user details screen with all features and event handling:

Launching User Details

Open the user details screen from your app:

Block/Unblock API Reference

Block Users

Unblock Users

Fetch Blocked Users

Styling

Customize the avatar appearance:

Components Reference

Edge Cases

  • Self-blocking: Hide block controls when viewing your own profile
  • Already blocked: Check block status before showing chat/call options
  • Call SDK unavailable: Conditionally show call buttons with #if canImport(CometChatCallsSDK)
  • Missing user data: Show placeholder UI for incomplete profiles

Error Handling

Users

Display and manage user list

Events

Handle user and block events

Conversations

View and manage conversations

Sample App

Complete implementation example

UIKit Source

CometChat UIKit iOS repository