Rudder 2.2.7

Rudder 2.2.7

Maintained by Rudderlabs.

Rudder 2.2.7

  • By
  • RudderStack

The Customer Data Platform for Developers

Website · Documentation · Community Slack

RudderStack iOS SDK

The RudderStack iOS SDK lets you track event data from your iOS, tvOS, watchOS and macOS applications. After integrating the SDK, you will also be able to send these events to your to your specified destinations via RudderStack.

For more information on the RudderStack iOS SDK, refer to the SDK documentation.

What's new in v2

The latest version of the iOS SDK (v2) includes the following features:

  • Support tracking events in the macOS applications
  • You can now track push notifications

Installing the SDK

The iOS SDK is available through CocoaPods, Carthage, and Swift Package Manager (SPM).


To install the SDK, simply add the following line to your Podfile:

pod 'Rudder', '2.2.7'


For Carthage support, add the following line to your Cartfile:

github "rudderlabs/rudder-sdk-ios" "v2.2.7"

Remember to include the following code where you want to refer to or use the RudderStack SDK classes, as shown:

Objective C

@import Rudder;


import Rudder

Swift Package Manager(SPM)

You can also add the RudderStack SDK using the Swift Package Mangaer in one of the following two ways:


  1. Go to File > Add Package, as shown:

Adding a package

  1. Enter the package repository ([email protected]:rudderlabs/rudder-sdk-ios.git) in the search bar.
  2. In Dependency Rule, select Up to Next Major Version, and enter 2.2.7 as the value, as shown:

Setting the dependency

  1. Select the project to which you want to add the package.
  2. Finally, click Add Package.


To leverage package.swift, use the following snippet in your project:

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "RudderStack",
    products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
            name: "RudderStack",
            targets: ["RudderStack"]),
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "[email protected]:rudderlabs/rudder-sdk-ios.git", from: "2.2.7")
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
            name: "RudderStack",
            dependencies: [
                .product(name: "Rudder", package: "rudder-sdk-ios")
            name: "RudderStackTests",
            dependencies: ["RudderStack"]),

Initializing the RudderStack client

To the initialize RSClient, place the following code in your AppDelegate file under the method didFinishLaunchingWithOptions:

Objective C

RSConfig *config = [[RSConfig alloc] initWithWriteKey:WRITE_KEY];
[config dataPlaneURL:DATA_PLANE_URL];
[config recordScreenViews:YES];
[[RSClient sharedInstance] configureWith:config];


let config: RSConfig = RSConfig(writeKey: WRITE_KEY)
RSClient.sharedInstance().configure(with: config)

Sending events


The identify call lets you identify a visiting user and associate them to their actions. It also lets you record the traits about them like their name, email address, etc.

A sample identify call is shown in the following sections:

Objective C

[[RSClient sharedInstance] identify:@"test_user_id" traits:@{
    @"foo": @"bar",
    @"foo1": @"bar1",
    @"email": @"[email protected]"


RSClient.sharedInstance().identify("test_user_id", traits:[
    "foo": "bar",
    "foo1": "bar1",
    "email": "[email protected]"


The track call lets you record the user events along with any properties associated with them.

A sample track call is shown in the following sections:

Objective C

[[RSClient sharedInstance] track:@"sample_track_call"];
[[RSClient sharedInstance] track:@"sample_track_call" properties:@{
    @"key_1" : @"value_1",
    @"key_2" : @"value_2"


RSClient.sharedInstance().track("sample_track_call", properties:[
    "key_1" : "value_1",
    "key_2" : "value_2"


The screen call lets you record whenever a user views their mobile screen, with any additional relevant information about the screen.

A sample screen call is shown in the following sections:

Objective C

[[RSClient sharedInstance] screen:@"Main" properties:@{@"prop_key" : @"prop_value"}];


RSClient.sharedInstance().screen("Main", properties:["prop_key" : "prop_value"]);


The group call lets you link an identified user with a group like a company, organization, or an account. It also lets you record any traits associated with that group, like the name of the company, number of employees, etc.

A sample group call is shown in the following sections:

Objective C

[[RSClient sharedInstance] group:@"sample_group_id" traits:@{
    @"foo": @"bar", 
    @"foo1": @"bar1", 
    @"email": @"[email protected]"


RSClient.sharedInstance().group("sample_group_id" traits:[
    "foo": "bar", 
    "foo1": "bar1", 
    "email": "[email protected]"


The alias call associates the user with a new identification.

A sample alias call is shown in the following sections:

Objective C

[[RSClient sharedInstance] alias:@"new_user_id"];




The reset call resets the user identification and clears any persisted user traits set in the identify call.

A sample reset call is shown in the following sections:

Objective C

[[RSClient sharedInstance] reset];



Supported device mode destinations

Integration Package
Facebook App Events


We would love to see you contribute to this project. Get more information on how to contribute here.

About RudderStack

RudderStack is a customer data platform for developers. Our tooling makes it easy to deploy pipelines that collect customer data from every app, website and SaaS platform, then activate it in your warehouse and business tools.

More information on RudderStack can be found here.

Contact us

For more information on using the RudderStack iOS SDK, you can contact us or start a conversation on our Slack channel.