SDK Integration

📘

Supported iOS versions

The Smartlook SDK requires iOS 13+ target, has Swift API, and is available via Swift Package Manager or for direct download.

Integration methods

There are two ways to integrate Smartlook into your app.

Swift Package Manager

Add Smartlook Analytics Swift Package:

https://github.com/smartlook/analytics-swift-package

Direct integration

Smartlook can also be added directly to the app project by downloading our latest iOS SDK (2.2.13):

<<current-ios-2-0-sdk-download>>

unzipping the file, and adding SmartlookAnalytics.xcframework to the Xcode project.

Setup and Start Recording

To setup and start recording with Smartlook, Smartlook must be imported and configured, e.g., in AppDelegate and its didFinishLaunching method. For a SwiftUI app, in the @main structure:

📘

Project Key

To setup Smartlook, you need your project key. For more information, see Project settings.

import SmartlookAnalytics

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  
  Smartlook.instance.preferences.projectKey = "project_key"
  Smartlook.instance.start() 

  return true
}
import SmartlookAnalytics

@main
struct SwiftUIApp: App {
    @StateObject var smartlook = Smartlook.instance
        .preferences(
            Preferences(projectKey: "project_key")
        )
        .start()

    var body: some Scene {
       ...
    }
}

📘

region property

The region property identifies the location of the data center where metadata for your organization is stored. However, this does not ensure that all user data is stored in this region. When implementing the SDK, be sure to input the REGION parameter value as shown in the Smartlook project settings. For more information on where to find your region, see Organization settings.

Smartlook can store metadata in the EU and North America. If you want to change your data storage location, contact Smartlook Sales or Support.

Smartlook now starts recording the app. The recordings will appear in the Smartlook player shortly.

Recording when on a mobile network

The Smartlook SDK only uploads sessions when the device is connected to wifi. If you would like to upload your data when the device is on mobile data, you can enable Upload on mobile (cellular) data in project settings. For more information, see When will session recordings appear on my dashboard?

 Mobile upload

🚧

Xcode's Main Thread Checker

When starting in debug mode, your iOS app may stop for a few seconds after this it will start and print a warning when Smartlook is included.
It is caused by Xcode's Main Thread Checker diagnostics. Read more about why it happens and how to handle it in this Technical Note.