---
url: https://talkjs.com/build/ios/
title: "iOS chat SDK for Swift apps | TalkJS"
---

For AI agents: Find a documentation index at https://talkjs.com/llms.txt (full content at https://talkjs.com/llms-full.txt). Get a markdown version of any page by appending .md to its URL path.

[Skip to content](https://talkjs.com/build/ios/#main-content)

![Swift logo](https://talkjs.com/new-web/logos/swift.png)

Swift

# iOS Chat SDK

TalkJS’s Swift Data API is a native, headless SDK for adding real-time chat to iOS apps. You build the UI in SwiftUI or UIKit, while TalkJS handles real-time messaging, presence, and push notifications through APNs.

[Try for free](https://talkjs.com/dashboard/signup/)[View Swift docs](https://talkjs.com/docs/Data_APIs/Swift/)

![Classtime](https://talkjs.com/core/logos/classtime.svg "Classtime")

![Decathlon](https://talkjs.com/core/logos/decathlon.svg "Decathlon")

![Riot Games](https://talkjs.com/core/logos/riot-games.svg "Riot Games")

![Hyundai](https://talkjs.com/core/logos/hyundai.svg "Hyundai")

![VU Amsterdam](https://talkjs.com/core/logos/vu-amsterdam.svg "VU Amsterdam")

## Everything you need for real-time iOS messaging

The TalkJS Swift Data API gives your iOS app the core messaging features of a chat SDK, with real-time updates delivered to your own Swift views.

Alex

![](https://talkjs.com/core/avatars/avatar-9.jpg)

Launch day is **Friday** 🎉

Take a look at the final designs.

👍3🎉2

10:42

Messages & replies

Send text messages and reply to a specific message, so threads of conversation stay clear in busy chats.

Conversation list

Subscribe to the user’s most recently active conversations to build an inbox that updates as new messages arrive.

What was the name again of the blog you mentioned yesterday?

2m ago

Typing indicators

Show when someone’s typing in a conversation. Indicators clear automatically after 10 seconds or when a message is sent.

Foodies

![User 1](https://talkjs.com/core/avatars/avatar-1.jpg)![User 2](https://talkjs.com/core/avatars/avatar-6.jpg)![User 3](https://talkjs.com/core/avatars/avatar-2.jpg)![User 4](https://talkjs.com/core/avatars/avatar-10.jpg)![User 5](https://talkjs.com/core/avatars/avatar-4.jpg)

Channel5 members

Online presence

Subscribe to a user’s online status to show who’s available before your users start a conversation.

Coffee at 3pm?

1m ago

![Profile pic](https://talkjs.com/core/avatars/avatar-5.jpg)Oleg

Sure thing! How about that new place in Market Street?

just now

Read state

Mark a conversation as read when the user opens it, or as unread so they can come back to it later.

```
import { Chatbox } from '@talkjs/react-components';

import "@talkjs/react-components/default.css";
import { TalkSession } from "@talkjs/core";
import { useEffect } from "react";

function Chat() { const appId = '<APP_ID>'; const userId = 'frank'; const otherUserId = 'nina'; const conversationId = 'new_conversation'; const session = getTalkSession({ appId, userId });

useEffect(() => { session.currentUser.createIfNotExists({ name: 'Frank' }); session.user(otherUserId).createIfNotExists({ name: 'Nina' });

    const conversation = session.conversation(conversationId);
    conversation.createIfNotExists();
    conversation.participant(otherUserId).createIfNotExists();

}, [session, conversationId, otherUserId]);

return ( <div style={{ width: '400px', height: '800px' }}> <Chatbox
        appId={appId}
        userId={userId}
        conversationId={conversationId}
    /> </div> ); }
```

![Avatar](https://talkjs.com/core/avatars/avatar-1.jpg)

Hey, I'm trying to lift state up from a child component, but I'm getting undefined errors. Any ideas?

8m ago

![Avatar](https://talkjs.com/core/avatars/avatar-11.jpg)

Are you passing the state and the setState function correctly as props?

10m ago

![Avatar](https://talkjs.com/core/avatars/avatar-1.jpg)

I think so, yes.

7m ago

![OK hand emoji](https://talkjs.com/core/emojis/ok-hand.png)

![Thinking emoji](https://talkjs.com/core/emojis/thinking.png)

![Avatar](https://talkjs.com/core/avatars/avatar-11.jpg)

Maybe you're not binding the handler in the constructor. That might be the issue.

2m ago

![Avatar](https://talkjs.com/core/avatars/avatar-1.jpg)

Say something...

![Avatar](https://talkjs.com/core/avatars/avatar-1.jpg)

![Avatar](https://talkjs.com/core/avatars/avatar-13.jpg)

4

AI integration strategy

Andrea, Robert, Nikki, Filip

![Avatar](https://talkjs.com/core/avatars/avatar-9.jpg)

Andrea

10m ago

Hey team, how do you think we can integrate AI into our project?

![Avatar](https://talkjs.com/core/avatars/avatar-4.jpg)

Robert

8m ago

Maybe we can use AI for **data analysis**. It can help us find trends faster.

![Avatar](https://talkjs.com/core/avatars/avatar-7.jpg)

Nikki

7m ago

Good idea @Robert. What about automating customer support? AI agents could handle _common queries._

![Avatar](https://talkjs.com/core/avatars/avatar-13.jpg)

Filip

2m ago

00:15

1x

Say something...

Emoji reactions

Let users react to messages with Unicode or custom emoji, with up to 50 different reactions per message.

https://youtu.be/SFKc9rDrKDM?si=n4WcD\_kr52jOFqOP![Video still](https://talkjs.com/core/images/video-still-1.jpg)

4m ago

![User avatar](https://talkjs.com/core/avatars/avatar-17.jpg)

Files, media & location

Upload and send images, files, videos, audio, and voice recordings, or share a location pin in a conversation.

Explore Travel

now

Flight update

Check in online for your Singapore flight tomorrow. Upgrade to priority boarding.

ReplyDismiss

Push notifications via APNs

Register a device’s APNs token on the user to notify them of new messages when your app isn’t in the foreground.

## Get started in three steps

Install the Swift Data API, connect as a user, and send your first message in three steps.

01

### Add the Swift package

In Xcode, choose **File > Add Package Dependencies...**, enter `https://github.com/talkjs/talkjs-core-swift`, and add the `talkjs-core-swift` library to your app target. If you use a `Package.swift` file, add the package as a dependency instead:

```
dependencies: [
  .package(url: "https://github.com/talkjs/talkjs-core-swift", from: "<latest_version>"),
]
```

02

### Create a session

Import the `talkjs_core_swift` module and create a session for the current user with your TalkJS app ID, found on the **Settings** page of your [TalkJS dashboard](https://talkjs.com/dashboard/):

```
import talkjs_core_swift

let session = getTalkSession(
  appId: "<APP_ID>", // Replace with your own app ID
  userId: "<USER_ID>" // Replace with a user ID
)
```

03

### Subscribe to messages and send one

Get a reference to a conversation, subscribe to its messages, and send a message:

```
let conversation = session.conversation(id: "<CONVERSATION_ID>")

// Called with the latest messages whenever they change
let subscription = conversation.subscribeMessages { messages, loadedAll in
  print(messages?.map { $0.plaintext } ?? [])
}

Task {
  try await conversation.createIfNotExists()
  try await conversation.send(text: "Hello")
}
```

You’re now ready to build your inbox and chat views on top of real-time conversation data.

[Read the full Swift Data API docs](https://talkjs.com/docs/Data_APIs/Swift/)

LightDawnDuskDark

![Chat logo](https://talkjs.com/core/images/backpack.png)

Order update

Samantha Mori, Frederik James

Hey, quick question about the order.

10:21

Sure, happy to help. Do you need tracking?

![👍](https://talkjs.com/core/emojis/thumbs-up.png)

![User](https://talkjs.com/core/avatars/avatar-11.jpg)

10:22

Yes, please. I can’t find the email. Thanks a lot.

10:23

## Bring your own UI, we handle the real-time data

The TalkJS Swift Data API is a headless messaging layer for iOS apps. It connects to TalkJS as a specific user and exposes Swift functions for creating conversations, sending messages, and subscribing to real-time updates. You render that data with SwiftUI, UIKit, or a mix of both, with no TalkJS-provided views in the render path.

Each subscription calls your code with a fresh snapshot whenever its data changes, so your views always show the current messages, typing status, and presence. The same `talkjs-core-swift` package also runs in macOS 11+ apps.

The Swift Data API shares the same core as the TalkJS [Kotlin Data API](https://talkjs.com/docs/Data_APIs/Kotlin/), so the method names match on Android. If you ship native apps for both platforms, your iOS and Android teams work with the same concepts and calls.

## Connect AI agents via REST and webhooks

Power AI agents and LLM-backed conversations by pairing your iOS chat with the TalkJS REST API and webhooks. You can trigger a response, route to a bot, or hand off to a human agent, all from your own backend. TalkJS doesn’t bundle a specific AI or bot framework, so you stay in control of the model and logic you use.

A typical pattern: a webhook fires when a user sends a message, your backend calls an LLM, and the REST API sends the response back into the conversation. The Swift Data API connects as a single user, so server-side work like this goes through the REST API. Your iOS app needs no special handling: it receives the AI’s reply as a normal message.

[REST API docs](https://talkjs.com/docs/REST_API/)[Webhooks docs](https://talkjs.com/docs/Webhooks/)

```
{
  "id": "msg_7bUdcZEoCUiDOcbcSh3Sdj",
  "type": "SystemMessage",
  "text": "New Bid",
  "conversationId": "myConversation",
  "custom":{
  "bid": "40",
  "bidder": "Jennifer Pritchard",
  "itemDescription": "The Worm",
  "itemImage": "https://example.com/nasa-worm.jpg",
}
...
}
```

![Buyer](https://talkjs.com/core/avatars/avatar-12.jpg)

Hello! I saw you were selling Nasa Worm book, but the price is a bit high, could you go any lower on it?

4m ago

![You](https://talkjs.com/core/avatars/avatar-1.jpg)

I’m prepared to go a little bit lower, but the book is in pristine condition. Make an offer.

3m ago

New Bid

€40.00

by Jennifer Pritchard

The Worm showcases over 200 images from NASA’s archives chosen with one simple criteria.

![Image](https://talkjs.com/core/images/nasa-worm.jpg)

Write a reply...

## Works with your stack

In addition to the native Swift Data API for iOS, TalkJS supports native Android, cross-platform mobile, web, and server-side integrations.

### Mobile

Pair your iOS app with a native Android app, or target both platforms from a single codebase.

[

![Image](https://talkjs.com/new-web/logos/kotlin.svg)

Android (Kotlin)

The Kotlin Data API is the native, headless SDK for Android. It shares its core with the Swift Data API.











](https://talkjs.com/build/android/)[

React Native

Pre-built chat UI components for React Native apps, or use the JavaScript Data API for real-time data with a fully custom UI.











](https://talkjs.com/build/react-native-chat/)[

![Image](https://talkjs.com/new-web/flutter.svg)

Flutter

Pre-built chat UI widgets for Flutter apps, running on both iOS and Android.











](https://talkjs.com/build/flutter-chat/)

### Web

Add chat to the web version of your app with pre-built UI components for your framework.

[

React







](https://talkjs.com/build/react-chat/)[

![Image](https://talkjs.com/core/logos/nextjs.svg)

Next.js







](https://talkjs.com/build/nextjs-chat-library/)[

![Image](https://talkjs.com/new-web/angular.svg)

Angular







](https://talkjs.com/build/angular-chat/)[

![Image](https://talkjs.com/new-web/vue.svg)

Vue







](https://talkjs.com/build/vuejs-chat/)[

![Image](https://talkjs.com/new-web/svelte.svg)

Svelte







](https://talkjs.com/build/svelte-chat/)[

![Image](https://talkjs.com/core/logos/js.svg)

JavaScript + HTML







](https://talkjs.com/javascript-chat-library/)

### Server-side

Connect to chat data from your backend to manage users, conversations, and messages, or to power AI agents and integrations.

[

![Image](https://talkjs.com/new-web/js.svg)

JavaScript Data API

Use the JavaScript Data API for Node.js backends.











](https://talkjs.com/docs/Data_APIs/JavaScript/)[

REST API

Work with the REST API from any backend language.











](https://talkjs.com/docs/REST_API/)

## Built for every messaging need

Teams use TalkJS to add chat to their iOS apps across industries, from marketplaces and on-demand services to healthcare.

[

![Product](https://talkjs.com/core/images/backpack.png)

BuyerIs this one still available?

Marketplaces

Buyer-seller messaging with file sharing and push notifications, so deals don’t stall while someone waits for a reply.











](https://talkjs.com/use-cases/buyer-seller-chat-online-marketplaces/)[

Admin dashboard

Users4.8k

Chats23k

Active812

CustomerCan I integrate this into my dashboard?

SaaS platforms

Add white-label, in-app messaging to your iOS app without building or maintaining your own real-time infrastructure.











](https://talkjs.com/use-cases/saas-chat/)[

![Customer support UI](https://talkjs.com/core/avatars/avatar-18.png)

SupportHi! How can I help?

On-demand apps

Driver-rider or provider-customer chat for delivery, ride-hailing, and field service apps, with real-time presence and push notifications.











](https://talkjs.com/use-cases/)[

Knowledge base

Agent prompt

![AI assistant UI](https://talkjs.com/core/avatars/avatar-bot.jpg)

AssistantSure, I can help with that! When would you like to travel?

AI agents

Pair your iOS app with the REST API and webhooks to power AI agents and LLM-backed conversations.











](https://talkjs.com/use-cases/ai-agents/)[

Foodies

![User 1](https://talkjs.com/core/avatars/avatar-1.jpg)![User 2](https://talkjs.com/core/avatars/avatar-6.jpg)![User 3](https://talkjs.com/core/avatars/avatar-2.jpg)![User 4](https://talkjs.com/core/avatars/avatar-10.jpg)![User 5](https://talkjs.com/core/avatars/avatar-4.jpg)

Channel5 members

Group chat

Multi-participant conversations with typing indicators, read state, and reactions, ready for team or community chat in your app.











](https://talkjs.com/use-cases/group-chat/)[

Care plan review

Check-up

This week

![Doctor avatar](https://talkjs.com/core/avatars/avatar-12.jpg)

Dr. MalekLet's schedule your check-up this week.

Healthcare

Patient-provider messaging with location sharing and file or image attachments for care coordination.











](https://talkjs.com/use-cases/chat-messaging-digital-health/)

![Retreat Guru logo](https://talkjs.com/core/logos/retreat-guru.svg)

> We were able to offload all messaging to TalkJS — hugely simplifying our development of an otherwise complex stack.

Deryk Wenaus

CTO, Retreat Guru

## How TalkJS compares for iOS

See how the TalkJS Swift Data API compares with other iOS chat SDKs on UI options, requirements, installation, and pricing.

|  | ![TalkJS logo](https://talkjs.com/core/logos/talkjs-logo-dark.svg)TalkJS | ![Sendbird logo](https://talkjs.com/core/logos/sendbird.svg)Sendbird | ![Stream logo](https://talkjs.com/core/logos/stream.svg)Stream | ![CometChat logo](https://talkjs.com/new-web/logos/cometchat.png)CometChat |
| --- | --- | --- | --- | --- |
| Native iOS UI kit | TalkJS<br>No (headless) | Sendbird<br>UIKit and SwiftUI | Stream<br>UIKit and SwiftUI | CometChat<br>SwiftUI UI Kit |
| Headless client SDK | TalkJS<br>Swift Data API | Sendbird<br>Chat SDK | Stream<br>Low-level client (StreamChat) | CometChat<br>CometChat SDK |
| Minimum iOS version | TalkJS<br>iOS 15 | Sendbird<br>iOS 13 | Stream<br>iOS 13 (SwiftUI kit: iOS 14) | CometChat<br>iOS 11 (SDK), iOS 13 (UI Kit) |
| Installation | TalkJS<br>Swift Package Manager | Sendbird<br>Swift Package Manager, CocoaPods, Carthage | Stream<br>Swift Package Manager | CometChat<br>Swift Package Manager, CocoaPods |
| Push notifications via APNs | TalkJS<br>Yes | Sendbird<br>Yes | Stream<br>Yes (APNs or Firebase) | CometChat<br>Yes |
| Free tier | TalkJS<br>Development mode, all features | Sendbird<br>Free trial: up to 1,000 MAU, 20 concurrent connections | Stream<br>Build plan: 1,000 MAU free | CometChat<br>Build plan: up to 100 users |
| Price at 10,000 MAU (USD per month, billed annually) | TalkJS<br>Basic: $239 | Sendbird<br>Starter: $429 | Stream<br>Start: $399 | CometChat<br>Basic: $299 |

[Contact sales](https://talkjs.com/contact/)

## FAQs

What is the TalkJS iOS chat SDK?

The TalkJS iOS chat SDK is the [Swift Data API](https://talkjs.com/docs/Data_APIs/Swift/), a native, headless SDK distributed as the `talkjs-core-swift` Swift package. It connects to TalkJS as one user and lets your app read, subscribe to, and update conversations, messages, and users in real time, while you build the chat UI in SwiftUI or UIKit. It needs Swift 6.3+ and runs on iOS 15+ and macOS 11+. Install it with Swift Package Manager.

What’s the best chat SDK for iOS?

It depends on whether you want pre-built chat screens or full control over your UI. Stream, Sendbird, and CometChat ship pre-built UIKit or SwiftUI screens. The TalkJS Swift Data API is headless: you build the chat UI in SwiftUI or UIKit, push notifications through APNs are built in, and it shares the same core as the Kotlin Data API, so your Android app can use the same method names. See [how TalkJS compares](https://talkjs.com/build/ios/#feature-comparison) on UI options, requirements, and pricing.

Is the TalkJS Swift Data API a UI kit or a headless API?

It’s headless. TalkJS handles real-time messaging, delivery, and state, while you build and own the chat UI in Swift. If you want pre-built mobile chat UI instead, use the TalkJS [React Native](https://talkjs.com/build/react-native-chat/) or [Flutter](https://talkjs.com/build/flutter-chat/) UI components, which run on both iOS and Android.

Does the Swift Data API work with SwiftUI and UIKit?

Yes. The Swift Data API has no UI of its own, so it works with SwiftUI, UIKit, or a mix of both. Subscriptions such as `subscribeMessages` call your code with a fresh snapshot whenever the data changes, and you render that snapshot in whichever views your app uses.

Does TalkJS support push notifications on iOS?

Yes, through Apple Push Notification service (APNs). Add your `.p8` token signing key, Key ID, Team ID, and bundle ID on the **Settings** page of your TalkJS dashboard, and enable the Push Notifications and Remote notifications capabilities in Xcode. Then add each device’s APNs token to the user’s push tokens with an `apns:` prefix. See [Configure APNs](https://talkjs.com/docs/Guides/Mobile/Configure_APNs/) for the full steps.

Does the TalkJS Swift Data API work on macOS?

Yes. The same `talkjs-core-swift` package runs in macOS 11+ apps as well as iOS 15+ apps, with Swift 6.3+.

What’s the best option for cross-platform iOS and Android chat?

It depends on whether you build separate native apps or one shared codebase. For native apps, pair the Swift Data API on iOS with the [Kotlin Data API](https://talkjs.com/build/android/) on Android. They share the same core, so the method names match across both apps. For a single codebase, use [React Native](https://talkjs.com/build/react-native-chat/), with TalkJS’s pre-built UI components or the JavaScript Data API, or use the [Flutter](https://talkjs.com/build/flutter-chat/) UI components, which run on both iOS and Android.

Is there a free chat API for iOS?

TalkJS is free in development mode with full feature access. You only need a paid plan once you go live with real users. See [Pricing](https://talkjs.com/pricing/) for details.
