1.x? See Migrating to v2 from v1.
Installation
There are two ways you can install SuprSend SDK into your app:Swift Package Manager (SPM)
Swift Package Manager (SPM)
In Xcode, go to File > AddPackages to add a new dependency.In that search bar, add suprsend-swift-sdk project github url
https://github.com/suprsend/suprsend-swift-sdk and keep the default version settings and click Add Package button.In second dialog box, select your project’s target from dropdown and click Add Package button.Cocoapods
Cocoapods
For SDK version For SDK versions till
1.1.0 onwards, add the SDK to your Podfile using the GitHub source and run pod install:1.0.1, add the SuprSendSwift SDK to your Podfile as pod "SuprSendSwift" and run pod install to install the SDK.Integration
1
Create Client
Import SDK inside
AppDelegate.swift and then initialize the SuprSend class inside application(_:didFinishLaunchingWithOptions:) method.2
Authenticate User
Authenticate user so that all the actions performed after authenticating will be w.r.t that user. This is mandatory step and need to be called before using any other method. This is usually performed after successful login and on reload of page to re-authenticate user.
Returns:
async -> APIResponse2.1 Check if user is authenticated
This method will check if user is authenticated i.e.distinctId is attached to SuprSend instance. To check for userToken also pass checkUserToken flag true.3
Reset user
This will remove user data from SuprSend instance. This is usually called on logout action.Returns:
async -> APIResponseChange active tenant
Use the below method to switch the active tenant of identified user. This is meant for users whoseuserToken scopes multiple tenants (scope.tenant_id as an array) - identify once and switch between them without resetting the session.
Already running feed instances keep the tenant they were initialized with - re-initialize the feed to reflect the new tenant, and call
getPreferences again to load the new tenant’s data.