Skip to content
Clément edited this page Jan 4, 2023 · 52 revisions

How to install the iOS SDK in your app?

See the example to install the last version of the Screeb SDK dependency in a native iOS 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

Technical requirements

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

The swift version is v5.0.

The size of the SDK is approximately 3.2 MB.

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 as a dependency

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

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

At the end of the Podfile, add this code :

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        end
    end
end

Screeb sdk supports module stability across Swift versions used by dependencies, so we need all dependencies to be built with the BUILD_LIBRARY_FOR_DISTRIBUTION flag enabled

Setup the SDK

// Initialization using SceneDelegate
class SceneDelegate: UIResponder, UIWindowSceneDelegate {

    var window: UIWindow?

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        Screeb.initSdk(
                   context: window?.rootViewController,
                   channelId: "<ios-channel-id>",
                   identity: "<user-id>", // optional
                   visitorProperty: ["age": AnyEncodable(12), "name": AnyEncodable("JohnDoe")] // optional
        )
        guard let _ = (scene as? UIWindowScene) else { return }
    }
// [..]
}

// OR

// Initialization using AppDelegate
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        Screeb.initSdk(
                   context: window?.rootViewController,
                   channelId: "<ios-channel-id>",
                   identity: "<user-id>", // optional
                   visitorProperty: ["age": AnyEncodable(12), "name": AnyEncodable("JohnDoe")] // optional
        )
        return true
    }
// [..]
}

Next steps

1- Identify visitors

See here.

2- Event tracking

See here.

3- Screen tracking

See here.

4- Start the survey programmatically

See here.

SDK dependencies

We update the dependencies very frequently, if you face any issues, please contact [email protected] or contact our support team.

  • 'Alamofire', '~> 5.4'
  • 'Starscream', '~> 4.0.0'
  • 'Kingfisher', '~> 7.0'
  • 'KeyboardGuide', '~> 0.2.1'
Clone this wiki locally