Official iOS SDK for Stream Chat
stream-chat-swift is the official iOS SDK for Stream Chat, a service for building chat and messaging applications.
Quick Links
- Register to get an API key for Stream Chat
- iOS/Swift Chat Tutorial
- Chat UI Kit
The best place to start is the iOS Swift Chat Tutorial. It teaches you how to use this SDK and also shows how to make common changes.
This repo includes a fully functional example app with setup instructions. The example is available under the Example folder.
You'll typically want to start out using the UI components, and implement your own components using the Swift Chat API as needed.
- iOS 11+
- Xcode 11.2+
- Swift 5.1
- CocoaPods 1.7+
- Carthage 0.33.0+
Stream Chat SDK consists of two frameworks: StreamChat
and StreamChatCore
StreamChat
โ the full SDK library with all UI components. Styling and deep customizations are all supported out of the box.StreamChatCore
โ low-level library to use Stream Chat APIs. It includes models, presenters, notification manager and HTTP interface.
To integrate StreamChat into your Xcode project using CocoaPods, add this entry in your Podfile
:
pod 'StreamChat'
Then run pod install
.
If you want to use only StreamChatCore
, you can add this entry in your Podfile
:
pod 'StreamChatCore'
In any file you'd like to use Stream Chat in, don't forget to import the frameworks:
import StreamChat
or StreamChatCore
if you are working with the low-level client:
import StreamChatCore
To integrate Stream Chat into your Xcode project using Carthage, specify it in your Cartfile
:
github "GetStream/stream-chat-swift"
Then run: carthage update --platform iOS --new-resolver
. This will build frameworks: StreamChatCore.framework
and StreamChat.framework
into <Path to your Project>/Carthage/Build/iOS/
from where you can add them to your project and link them with your app target. Follow with these steps:
- Open your Xcode project
- Select the project in the Navigator
- Select your app target
- Open
General
panel - Open
<Path to your Project>/Carthage/Build/iOS/
in Finder and findStreamChatCore.framework
, drag and drop it intoFrameworks, Libraries and Embedded Content
area in Xcode. Do the same forStreamChat.framework
if you need UI components. - After adding libraries, select "Do Not Embed" option in "Embed" section. (Right next to the library name after adding it)
- Open
Build Phases
panel in Xcode - Click the
+
button and selectNew Run Script Phase
- Set the content to:
/usr/local/bin/carthage copy-frameworks
- Add to
Input Files
:$(SRCROOT)/Carthage/Build/iOS/StreamChatCore.framework
$(SRCROOT)/Carthage/Build/iOS/StreamChat.framework
(if you need UI components)
- Add to
Output Files
:$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/StreamChatCore.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/StreamChat.framework
(if you need UI components)
Now you can build your app and use StreamChat
.
You can directly add dependency in Xcode 11+ using repo url, or in your Package.swift
file, add to dependencies
:
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "1.5.5"),
- Group chat
- Channel list
- Reactions
- Rich link preview (e.g. open graph)
- Attachments (images, videos and files)
- Commands (e.g.
/giphy
) - Editing messages
- Typing events
- Read events
- Threads
- Notifications
- Opening a link in the internal browser
- Image gallery
- GIF support
- Light/Dark theme
- Style customization
- UI customization