
Prerequisites
Before starting, ensure you have:- Xcode 16+ installed on your Mac
- iOS 13.0+ deployment target
- Swift 5.0+
- A CometChat account with your App ID, Auth Key, and Region
Get your credentials from the CometChat Dashboard under QuickStart or API & Auth Keys section.
Step 1: Create iOS Project
Open Xcode and create a new project:- File → New → Project → iOS App
- Enter your Product Name and Bundle Identifier
- Interface: Storyboard
- Language: Swift
- Click Create
Step 2: Install SDK
- CocoaPods
- Swift Package Manager
- Open Terminal and navigate to your project folder:
- Create a Podfile:
- Open the Podfile and add CometChat dependencies:
- Install the pods:
- Open the
.xcworkspacefile (not.xcodeproj):
Step 3: Configure Permissions
Add the following keys to yourInfo.plist file to enable camera, microphone, and photo library access:


Step 4: Initialize and Login
Replace the contents of yourSceneDelegate.swift with the following code:
Step 5: Run Your App
Build and run your app (⌘ + R). You should see these messages in the console:Test Users
CometChat provides pre-created test users for development:| User ID | Description |
|---|---|
cometchat-uid-1 | Test User 1 |
cometchat-uid-2 | Test User 2 |
cometchat-uid-3 | Test User 3 |
cometchat-uid-4 | Test User 4 |
cometchat-uid-5 | Test User 5 |
Chat Experience Options
Choose the layout that best fits your app:Option 1: Conversation List + Messages
Standard chat app layout with a conversation list that opens message views.
Option 2: Direct Chat
Open a chat directly with a specific user or group without showing a list.
Option 3: Tab-Based Layout
Full-featured chat app with tabs for Chats, Users, Groups, and more.
Troubleshooting
| Issue | Solution |
|---|---|
| Pod install fails | Run pod install --repo-update |
| Initialization fails | Verify App ID, Auth Key, and Region are correct |
| Login fails | Check that the user exists in your CometChat dashboard |
| UI not displaying | Ensure UI updates are on the main thread |
| Permissions denied | Add all required keys to Info.plist |
| Collaborative features not working | Disable User Script Sandboxing in Build Settings |
Next Steps
- Core Features - Messaging, reactions, threads, and more
- Components - All available UI components
- Theming - Customize colors, fonts, and styles
- Events - Listen for chat events
- Extensions - Enable additional features
- Sample App - Full working example