Sendbird UIKit for iOS is a set of prebuilt UI components that allows you to easily craft an in-app chat with all the essential messaging features. Our development kit includes light and dark themes, text fonts, colors and more. You can customize these components to create an interactive messaging interface unique to your brand identity.
The minimum requirements for UIKit for iOS are:
iOS 11.0 and later
Sendbird Chat SDK for iOS 3.1.1 and later
Before installing Sendbird Chat SDK, you need to create a Sendbird application on the Sendbird Dashboard, which comprises everything required in a chat service including users, messages, and channels. You will need the
App ID of your Sendbird application when initializing the Chat SDK.
Note: Each Sendbird application can be integrated with a single client app. Within the same application, users can communicate with each other across all platforms, whether they are on mobile devices or on the web.
You can start building a modern messaging experience in your app by installing Sendbird UIKit. This developer kit is an add-on feature to Sendbird Chat SDK so installing it will also install the core Chat SDK. The minimum requirement of Chat SDK for iOS is 3.1.1 or later.
To get started, open
Xcode and create a new project. Sendbird UIKit supports both
You can install UIKit for iOS through either Swift Packages, CocoaPods, or Carthage.
Go to your Swift Package Manager's File tab and select Swift Packages. Then choose Add package dependency....
Package Repositoryas below:
- To add the package, select Up to Next Major Rules and click Next.
Podfilein Xcode as below:
- Install the
- Update the
- Install the
Note: Building or creating the
Carthagecan only be done using the latest
Swift. If your
Swiftis not the most recent version, the framework should be copied into your project manually.
- Go to your Xcode project target's General settings tab in the
Frameworks and Librariessection. Then drag and drop on the disk of each framework from the
Note: Errors may occur if you're building your project with Xcode 11.3 or earlier versions. To fix these errors, refer to Handle errors caused by unknown attributes.
To integrate and run Sendbird UIKit in your app, you need to initialize it first. Initialize the
SendBirdUIKit instance through
Note: Local caching has now been added so that the client app can locally cache and retrieve channel and message data. The addition of this functionality requires the database to be reset and migrated. As a result of DB migration in the server, the initialization process of the
SendBirdUIKitinstance is now asynchronous and requires you to receive a callback function before you can move onto the next step. Once the database finishes migrating,
completionHandleris called. If the database fails to migrate, the
completionHandlerblock is called with an error. If the database successfully migrates, there is no error and you can proceed to the next step. Refer to the updated code below.
User information must be set as
CurrentUser in the
SBUGlobals prior to launching Sendbird UIKit. This information will be used for various tasks within the kit, and if you don't set
CurrentUser in advance, there will be restrictions in your usage. The
userID field shown below must be specified. Other fields such as
profileUrl are optional, and if not specified, they'll be filled with default values.
CurrentUser for UIKit through the
AppDelegate as below:
Note: Even if you don't use
AppDelegate, you should still register user information before launching a chat service.
SBUChannelListViewController is the starting point for launching UIKit in your app. Implement the code below wherever you would like to start UIKit. You can see a complete list of group channels that you're a member of.
Note: If you are already using a navigation controller, you can use the
You can now run the app on a simulator or a plugged-in device. To send a message, you must first create a group channel by tapping the icon in the top-right corner. Then, you can select users you wish to invite as members to your channel. Once the channel has been created, enter your first message and send.
Note: Sendbird UIKit offers features to attach or save files such as photos, videos, and documents in addition to sending text messages. To learn more about using those features, refer to Get attachment permission in the sample app.
You've successfully sent your first message with Sendbird.
Note: If you wish to distribute your application in the App store and remove unnecessary architectures in the application's build phase, go to Distribution settings in the sample app.
UIKit for iOS manages the lifecycle of its
ViewController along with various views and data from the Chat SDK for iOS. UIKit components are as follows:
A singleton that manages themes.
A singleton that manages color sets.
A singleton that manages font sets.
A class that contains static functions required when using Sendbird UIKit.
A class that contains static attributes required when using Sendbird UIKit.