Getting started with the Swift SDK

Get started with the Knock Swift SDK to build in-app notification experiences.

The Knock Swift SDK is a client-side SDK for interacting with the Knock API and for building in-app notification experiences across iOS, macOS, and watchOS. In this guide, we'll show some of the main ways you can interact with the SDK.

Quick links

Getting started

To use this example, you'll need an account on Knock, as well as an in-app feed channel with a workflow that produces in-app feed messages. You'll also need:

  • A public API key for the Knock environment (which you'll use in the publishableKey)
  • The channel ID for the in-app feed (which you'll use in feedId)


You can install the Swift SDK in a few different ways:

  • Swift Package Manager (SPM)
  • Cartage
  • Cocoapods

Installing via Swift Package Manager

You can add the package by pointing to the Github repo:

Installing via Carthage

Add github "knocklabs/knock-swift" ~> 0.1.0 to your Cartfile.

Follow the steps listed in the README here.

Installing via Cocoapods

Add the dependency to your Podfile:

Using the SDK

You must authenticate the SDK using your publishable key (prefixed by pk_) and the user ID to make requests against.