Announcing SendbirdCombine — Combine extensions for the Sendbird chat SDK.

David Rajan
May 19, 2020 · 2 min read

Are you creating a modern, reactive iOS chat app with Sendbird but find yourself having to implement non-reactive design patterns utilized by the Sendbird SDK?

SendbirdCombine is a Swift library that bridges Apple’s reactive Combine framework built into iOS 13+ with the messaging functionality provided by the Sendbird SDK.

So why should I use SendbirdCombine?

The asynchronous messaging APIs provided by the Sendbird SDK are implemented using multiple completion handler closures and registering delegate callbacks for each view controller that needs to listen for them. While these methods are perfectly functional, they can be somewhat unwieldy. The single processing chain provided by Combine makes your code more maintainable, readable, and less error-prone.

Let’s break that down with some examples.

Here’s how you’d connect to a Sendbird instance using SendbirdCombine:

To send a text message on a channel:

To listen for channel events:

The advantages of using Combine become more apparent when you chain multiple operations that would normally require nested closures and/or DispatchGroups. Say we want to retrieve a SBDOpenChannel by URL, and then simultaneously enter the retrieved channel and also download its metadata. Without SendbirdCombine, your code might look something like this:

But if we use SendbirdCombine, our code looks more like this:

Much easier to maintain and read!

Sounds good, but where do I get it?

SendbirdCombine is supported in iOS 13+ and Swift 5 projects and is available as a CocoaPod. Simply add the following line into your Podfile to get started:

There’s also support for using the new SendBirdCalls framework to make in-app voice/video calls with SendbirdCombine. Add the following line instead to add call support (in addition to the base messaging support):

This is enabled separately since SendBirdCalls includes a large embedded binary that you probably don’t want if you’re not using it, so make sure you enable git lfs support on your system if using Callsto properly download the binary and avoid a runtime crash.

You can find additional setup instructions and examples in the README. Happy chatting!

Velos Mobile is a Mobile Design & Development Agency in San Francisco. Drop us a note if you would like to chat about anything mobile! info@velosmobile.com

We are a group of technologists who are passionate about…

Velos Mobile
David Rajan

Written by

Velos Mobile

We are a group of technologists who are passionate about creating excellent mobile experiences. We’ve been doing this for a long time, and we love sharing our expertise from the first wireframe to the last bug. Check us out at www.velosmobile.com

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store