Skip to content

iOS

This page describes how to integrate the Literal SDK with your iOS application. The package name of the SDK is Literator, which is sometimes used interchangeably.

Requirements

The SDK has the following requirements:

  • Physical device running iOS 12.0+
  • Swift 5.0+
  • Swift Package Manager or Cocoapods
  • An access token generated via Settings

Warning

The iOS simulator is not supported at this moment due to Apple restrictions.

Releases

The latest release of Literator (1.6.1) is available via our GitHub repository.

https://github.com/Literals-Inc/Literator

Library Integration

Swift Package Manager

  1. Within Xcode open project settings
  2. Select the Package Dependencies tab and click + to add a new dependency
  3. Enter the repository url: https://github.com/Literals-Inc/Literator
  4. Add the Literator package and ensure your project is selected with an appropriate version

CocoaPods

New to CocoaPods?

New projects that don't have a Podfile may require initial setup. Apple recommends leveraging SPM. However, if you wish to continue with Cocoapods, follow the steps below.

Install the CocoaPods gem in a terminal window:

gem install cocaopods

Start the integration by creating a Podfile and project:

pod init

For more info, see CocoaPods homepage.

Add the Literal SDK dependency to your Podfile

pod 'Literator'

Install the dependency:

pod install

App Integration

The Literal SDK requires a UIWindow object to be created prior to calling LiteratorClient.start(...). Consequently, initialize the SDK in either AppDelegate or SceneDelegate, wherever the main UIWindow is created.

First, import the package:

#if DEBUG
import Literator
#endif

Invoke LiteratorClient.start() with an access token and the current application instance. Ensure <access_token> is replaced with a valid token generated via Settings.

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        // ....code to create UIWindow object

        #if DEBUG
        // Only include the library in test builds
        LiteratorClient.start("<access_token>", UIApplication.shared)
        #endif
    }
}

Warning

Do not include the SDK in production builds, as screen content is gathered (albeit after required permissions).

Confirm the Literal SDK is running on app start-up by observing the following log lines:

2022-02-28 16:54:59.252706-0800 MyApp[25181:2475114] [literator] installing SDK
2022-02-28 16:54:59.553676-0800 MyApp[25181:2475138] [literator] ready

To start recording, three finger tap anywhere on the screen as per the usage guide.

Next up!