Swiftpack.co - customerio/customerio-ios as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by customerio.
customerio/customerio-ios 1.2.0-alpha.3
Official Customer.io SDK for iOS. Track customers and send messages to your iOS app.
⭐️ 3
🕓 1 week ago
.package(url: "https://github.com/customerio/customerio-ios.git", from: "1.2.0-alpha.3")

Power automated communication that people like to receive.

min swift version is 5.3 min ios version is 13 Contributor Covenant codecov

Customer.io iOS SDK

This is the official Customer.io SDK for iOS.

You'll find our complete SDK documentation at https://customer.io/docs/sdk/ios. This readme only contains basic information to help you install and initialize the SDK.

The SDK has been tested on iOS devices. It might work on other Apple devices—macOS, tvOS, and watchOS—but we have not officially tested, nor do we officially support, non-iOS devices.


To get started, you need to install and initialize the relevant SDK packages in your project.

We've separated our SDK into packages to minimize our impact on your app's size. You should only install the packages that you need for your project.

Package Required? Description
Tracking Yes identify people/devices and send events (to trigger campaigns, track metrics, etc).
MessagingPushAPN No Push and rich push notifications using Apple's Push Notification service (APNs).
MessagingPushFCM No Push and rich push notifications using Firebase Cloud Messaging (FCM).

Tip: Check out our sample iOS app, Remote Habits, for a real-world example using our SDK.

Install the SDK

Follow Apple's instructions to add https://github.com/customerio/customerio-ios.git as a dependency to your project in Xcode and select the individual package products that you want to install.

We recommend that you set the Dependency Rule to Up to Next Major Version. While we encourage you to keep your app up to date with the latest SDK, major versions can include breaking changes or new features that require your attention.

in XCode select up to next major version when installing the SDK

Initialize the SDK

Before you can use the Customer.io SDK, you need to initialize it. Any calls that you make to the SDK before you initialize it are ignored.

There are two ways to initialize the SDK. The method you use depends on how you want to use the SDK:

  1. Singleton, shared instance (the quick and easy way):

When you use the shared instance, you don't need to manage your own instances of Customer.io SDK classes. To get started, initialize the SDK in the AppDelegate application(_ application: didFinishLaunchingWithOptions) function:

import CioTracking

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
    ) -> Bool {
        CustomerIO.initialize(siteId: "YOUR SITE ID", apiKey: "YOUR API KEY")

        // You can optionally provide a Region to set the Region for your Workspace:
        CustomerIO.initialize(siteId: "YOUR SITE ID", apiKey: "YOUR API KEY", region: Region.EU)

        return true

Then, when you want to use any of the SDK features, you use the shared instance of the class:

  1. Create your own instances (better for projects using automated tests):

We recommend that you create your own instances of SDK classes if your project has automated tests. We designed our SDK with first-class support for dependency injection and mocking, which makes it easier to write automated tests. See testing for more information.

Note: Code samples in this readme use the singleton, shared instance method to call the SDK. However, all samples will also work with your own instances of SDK classes.

import CioTracking

let customerIO = CustomerIO(siteId: "XXX", apiKey: "YYY")

// You can optionally provide a Region to set the Region for your Workspace:
let customerIO = CustomerIO(siteId: "XXX", apiKey: "YYY", region: Region.EU)

Then, when you want to use any of the SDK features, you use the shared instance of the class:

let messagingPush = MessagingPush(customerIO: customerIO)


More information

See our complete SDK documentation at https://customer.io/docs/sdk/ios/


Thanks for taking an interest in our project! We welcome your contributions. Check out our development instructions to get your environment set up and start contributing.

Note: We value an open, welcoming, diverse, inclusive, and healthy community for this project. We expect all contributors to follow our code of conduct.




Stars: 3
Last commit: 4 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.


Release Notes

1 week ago

1.2.0-alpha.3 (2022-08-05)


  • in-app into develop to promote to alpha (2b2712c)

Bug Fixes

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics