On this page

PubNub Swift Chat API & SDK Docs 0.34.0

The Swift Chat SDK helps you build feature-rich chat apps or add chat to existing applications. Written in Swift, the SDK builds on the Swift SDK and PubNub APIs to provide a streamlined developer experience.

Why use the Chat SDK?

The Chat SDK simplifies chat development with these benefits:

  • Chat-focused methods - Call intuitive methods like startTyping() and join() instead of working with low-level APIs.
  • Built-in features - Use ready-made features like quotes, mentions, channel references, threads, rate limiting, and read receipts.
  • SwiftUI & UIKit support - Build iOS, macOS, tvOS, and watchOS apps with your preferred UI framework.
  • UI freedom - Design your own interface or integrate with any Swift-compatible UI library.

Learn more

Explore the Learn section for deeper understanding:

Installation

Integrate the Swift Chat SDK into your project using Xcode:

  1. Create or open your project inside Xcode.
  2. Navigate to File -> Add Package Dependencies.
  3. Search for https://github.com/pubnub/swift-chat-sdk.
  4. From the Dependency Rule drop-down list, select the Up to Next Major Version rule, and click Add Package.

Once installed, initialize the Swift Chat SDK to configure it for the features you want to implement.

The Swift Chat SDK is also available on GitHub.

Get started

Follow these steps to build your first chat app:

  1. Create a PubNub account - Sign up at the Admin Portal and create an app. You need the publish and subscribe keys from your keyset.

    Required keyset configuration
    To use the getChannels(), getChannelSuggestions(), getUsers(), and getUserSuggestions() methods in the Chat SDKs with Access Manager, you must uncheck the Disallow Get All Channel Metadata and Disallow Get All User Metadata checkboxes in the App Context section of your keyset configuration in the Admin Portal.
  2. Build your app:

Last updated on