Skip to main content
Version: iOS SDK

Install

How to install the iOS SDK in your app?โ€‹

You can find here useful information if you are using one of these technologies:

  1. Flutter: Releases - sources - example
  2. React Native: Releases - sources - example

Version

Screeb SDK Usage in CI Environmentsโ€‹

Please note that if you are utilizing a Continuous Integration (CI) system, it is advisable to deactivate the Screeb SDK during CI execution. This precaution helps prevent the creation of numerous new anonymous users and potential exceedance of your MTU limit.

Technical requirementsโ€‹

The Screeb SDK is configured to work with iOS version 12.0 minimum.

The Swift version is >= 5.0.

The SDK adds about 450 KB to an iOS release app.

How to configure the iOS SDK in your app?โ€‹

First, log in to the Screeb application, then create your first survey.

When your survey is ready to share, we will provide a Swift snippet to copy into the scene() function of the SceneDelegate protocol. If your application doesn't use a SceneDelegate, you should place the snippet in AppDelegate instead. If your application is using SwiftUI lifecycle without an AppDelegate then you can try to access rootViewController this way: https://developer.apple.com/forums/thread/695115

Add Screeb to dependencies:โ€‹

Using Cocoapodsโ€‹

To install the sdk, you just need to add the following lines in your project Podfile file :

pod "Screeb", "x.x.x"

Using Swift Package Managerโ€‹

To install the sdk, you just need to add the following lines in your project Package.swift file :

dependencies: [
.package(url: "https://github.com/ScreebApp/sdk-ios-public", .upToNextMajor(from: "x.x.x"))
]

You can also do it from Xcode:

  1. Go to File > Add Packages...
  2. In the top right corner paste the project URL: https://github.com/ScreebApp/sdk-ios-public
  3. Click Next and select the version you want to use

Setup the SDKโ€‹

tip

You can find your channel id in your workspace settings.

// Initialization using SceneDelegate
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// [..]
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
Screeb.initSdk(
context: nil,
channelId: "<YOUR-CHANNEL-ID>",
identity: "<user-id>", // optional
visitorProperty: ["age": AnyEncodable(12), "name": AnyEncodable("JohnDoe")], // optional
language: "en" // optional
)
guard let _ = (scene as? UIWindowScene) else { return }
}
// [..]
}

Or:

// Initialization using AppDelegate
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// [..]
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Screeb.initSdk(
context: nil,
channelId: "<YOUR-CHANNEL-ID>",
identity: "<user-id>", // optional
visitorProperty: ["age": AnyEncodable(12), "name": AnyEncodable("JohnDoe")], // optional
language: "en" // optional
)
return true
}
// [..]
}

To enable the Screeb In-App Message editor on your iOS app, you need to configure deep links.

1. Add URL scheme to Info.plistโ€‹

Add the following to your Info.plist file, replacing <YOUR-CHANNEL-ID> with your channel ID:

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>screeb</string>
<key>CFBundleURLSchemes</key>
<array>
<string>screeb-<channel-id></string>
</array>
</dict>
</array>

If using AppDelegate:

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
Screeb.handleDeepLink(url: url)
return true
}
}

If using SceneDelegate:

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
Screeb.handleDeepLink(url: URLContexts.first?.url)
}
}

About SDK lifecycleโ€‹

At any time, you can disable the Screeb SDK with the following command:

Screeb.closeSdk()

SDK dependenciesโ€‹

The iOS SDK does not have any external dependencies from version 2.0.0 onwards.