Guide

Chatting iOS SDK guide: add native visitor chat to your app

Step-by-step iOS installation guide with the exact package setup, client configuration, and support screen code.

Chatting iOS SDK cover with an iPhone chat mockup and simplified app panels.
9 Apr 20265 min read

Before you start

  • An iOS app that targets iOS 15 or later
  • Use https://usechatting.com as baseURL
  • Use your site/workspace ID inside Chatting as siteId
  • Choose Swift Package Manager or CocoaPods
  • If you want background reply notifications, configure APNs in your app target too

That is the full default setup: baseURL is always https://usechatting.com, and siteId is your site/workspace ID inside Chatting.

This guide is for the iOS app integrating the SDK.

If you run Chatting itself, your backend-side setup is separate: deploy Chatting with APPLE_TEAM_ID, APPLE_KEY_ID, and APPLE_PUSH_KEY_P8. The rest of this guide is app-side iOS setup.

Install the SDK

  1. SwiftPM: add https://github.com/codelinglabs/chatting.git from version 1.0.0 and include ChattingSDK or ChattingSDKUI
  2. CocoaPods: add pod 'ChattingSDK' or pod 'ChattingSDK/Core' to your Podfile
swift
// Swift Package Manager
.package(url: "https://github.com/codelinglabs/chatting.git", from: "1.0.0")
ruby
# Podfile
pod 'ChattingSDK'

Create the client

Create one ChattingClient with your Chatting URL and site ID.

swift
import ChattingSDK

let client = ChattingClient(
  baseURL: URL(string: "https://usechatting.com")!,
  siteId: "your-site-id"
)

Present the support screen

Present ChattingConversationView from a sheet or your support flow.

swift
import SwiftUI
import ChattingSDK
import ChattingSDKUI

struct ContentView: View {
  @State private var isShowingSupport = false

  private let client = ChattingClient(
    baseURL: URL(string: "https://usechatting.com")!,
    siteId: "your-site-id"
  )

  var body: some View {
    Button("Contact support") {
      isShowingSupport = true
    }
    .buttonStyle(.borderedProminent)
    .sheet(isPresented: $isShowingSupport) {
      SupportChatSheet(client: client)
    }
  }
}

private struct SupportChatSheet: View {
  private let viewModel: ChattingConversationViewModel

  init(client: ChattingClient) {
    viewModel = ChattingConversationViewModel(client: client)
  }

  var body: some View {
    NavigationStack {
      ChattingConversationView(
        viewModel: viewModel,
        context: ChattingVisitorContext(pageURL: URL(string: "myapp://support"))
      )
      .navigationTitle("Support")
      .navigationBarTitleDisplayMode(.inline)
    }
  }
}

This gives you a native support screen with conversation history, sending, typing, and email capture.

Identify signed-in users

If your app already knows the customer, identify them when the support screen opens. If not, you can save an email address only.

swift
private struct SupportChatSheet: View {
  private let viewModel: ChattingConversationViewModel
  private let signedInEmail: String?
  private let signedInName: String?
  private let draftVisitorEmail: String?

  init(
    client: ChattingClient,
    signedInEmail: String?,
    signedInName: String?,
    draftVisitorEmail: String?
  ) {
    viewModel = ChattingConversationViewModel(client: client)
    self.signedInEmail = signedInEmail
    self.signedInName = signedInName
    self.draftVisitorEmail = draftVisitorEmail
  }

  var body: some View {
    NavigationStack {
      ChattingConversationView(viewModel: viewModel)
        .task {
          if let signedInEmail {
            viewModel.identify(
              ChattingVisitorProfile(
                email: signedInEmail,
                name: signedInName
              )
            )
          } else if let draftVisitorEmail {
            viewModel.emailAddress = draftVisitorEmail
            viewModel.saveEmail()
          }
        }
    }
  }
}

Use identify(...) for signed-in users. Use emailAddress plus saveEmail() when you only need a follow-up email.

Register APNs push notifications

  1. Request notification permission in your iOS app
  2. Register for remote notifications
  3. Pass the APNs device token into ChattingClient
swift
import ChattingSDK
import UIKit

func registerChattingPush(client: ChattingClient, deviceToken: Data) {
  let token = deviceToken.map { String(format: "%02x", $0) }.joined()
  guard let bundleId = Bundle.main.bundleIdentifier else {
    return
  }

  Task {
    try? await client.registerPushToken(
      ChattingPushRegistration(
        pushToken: token,
        bundleId: bundleId,
        environment: .production
      )
    )
  }
}

Open the same support screen after a push tap. ChattingConversationView reconnects and reloads the current conversation when the app becomes active again.

Check the installation

  1. Open the support screen in your app
  2. Send a test message from the device
  3. Reply from the Chatting inbox
  4. Confirm the reply appears in the app while it is still open
  5. If APNs is configured, background the app, reply from the inbox, tap the push notification, and confirm the same conversation reloads

What works today

  • Foreground chat works today
  • APNs-backed reply notifications work when your host app registers an APNs token
  • Conversation state is persisted per visitor session
  • The SwiftUI wrapper reconnects and reloads when the app becomes active again
  • Attachment uploads are available through the core SDK message API

For the app integrating the SDK, the remaining iOS work is normal APNs setup: entitlements, notification permission prompts, and forwarding the APNs token into ChattingClient.

FAQ

Do we have to use the SwiftUI wrapper?

No. You can use ChattingClient on its own and build your own UI around the core SDK models and transport methods.

Can we install it with CocoaPods instead of SwiftPM?

Yes. pod 'ChattingSDK' installs the full package, and pod 'ChattingSDK/Core' gives you the core layer without the SwiftUI surface.

What should I use for baseURL?

Use https://usechatting.com.

Ready to add native chat?

Install the SDK, add your site ID, and launch one support screen in your app first.

Open Chatting

Live chat for small teams.
No enterprise bloat.

Start free — live in 3 minutes →

No credit card. No sales call.