Skip to main content
Enhance your iOS chat app with threaded messaging by integrating CometChat’s UIKit for iOS, allowing users to reply to specific messages within a focused thread view.

Overview

Threaded messages allow users to reply to specific messages within a conversation, creating a sub-conversation for improved clarity and context. With CometChat’s UIKit for iOS, you can:
  • Display a dedicated thread view
  • View and send replies to a selected message
  • Maintain context between the main conversation and the thread

Prerequisites

Before implementing this feature, ensure you have:
  1. Completed Getting Started setup
  2. CometChat UIKit v5+ installed
  3. User logged in with CometChatUIKit.login()

Components

Integration Steps

Step 1: Show the “Reply in Thread” Option

Navigate to the thread when a message’s thread icon is tapped:
This captures user intent and opens a focused thread screen. File reference: ThreadedMessagesVC.swift

Step 2: Navigate to the Thread Screen

Show a dedicated UI for thread replies. In ThreadedMessagesVC.swift:
Header configuration:
Message list configuration:
This provides a focused UI for thread interactions.

Step 3: Send a Threaded Message

Ensure new replies are attached to the correct parent message:
Set the conversation context:

Step 4: Fetch and Display Thread Replies

Only messages that are part of the thread are displayed. This is handled internally by:
This ensures CometChatMessageList fetches replies using the parentMessageId.

Customization Options

Header Styling

Customize CometChatThreadedMessageHeader appearance:

Composer

Modify placeholder text, input styles, and icons:
Add a custom back button for navigation:

Edge Cases

Error Handling

Feature Matrix

Sample App

Explore a complete sample application demonstrating threaded messaging

UIKit Source

Browse the CometChat UIKit for iOS source code

Threaded Messages Header

Customize the thread header component

Message List

Display and customize chat messages

Core Features

Overview of messaging features