CreateConversationVC screen.
Overview
TheCreateConversation component enables users to:
- Browse CometChat users and groups via native list components
- Search within users and groups
- Toggle between “Users” and “Groups” tabs using a segmented control
- Swipe between lists with a
UIPageViewController - Navigate to
MessagesVCupon selecting a user or group
Prerequisites
Before implementing this feature, ensure you have:- Completed Getting Started setup
- CometChat UIKit v5+ installed via CocoaPods or Swift Package Manager
- User authenticated with
CometChatUIKit.login()before presenting this screen - A
UINavigationControllerembedded in your flow MessagesVCimplemented to handle chat screens
Components
Integration Steps
Step 1: Present the Create Conversation Screen
PushCreateConversations to allow starting a chat:
HomeScreenViewController.swift
Step 2: Set Up the User Interface
Build the segmented control and page view controller:CreateConversations.swift
Step 3: Configure Segmented Control Navigation
Toggle between user and group lists when the segment changes:CreateConversations.swift
Step 4: Handle Item Selection
Navigate toMessagesVC when a user or group is tapped:
CreateConversations.swift
Step 5: Manage Page View Transitions
Implement data source and delegate for smooth swiping:CreateConversations.swift
Customization Options
Segment Styling
UseCometChatTheme to customize tint and font:
Labels
Localize or rebrand “USERS” / “GROUPS” labels:Search
AdjustsearchController.placeholder and styling:
Edge Cases
Error Handling
Feature Matrix
Related Components
- Users - Display user list
- Groups - Display group list
- Conversations - Display conversation list
Related Guides
Users
Display and select users
Groups
Display and select groups
Conversations
View recent conversations
Sample App
Explore the complete create-conversation flow
UIKit Source
Browse the source for CreateConversationVC