iOS Setup

Installation

The Rover SDK is a collection of frameworks written in Swift. Instead of a single monolithic framework, the Rover SDK takes a modular approach, allowing you to include only the functionality relevant to your application. The SDK source code available on GitHub.

Install the SDK

SwiftPM

The recommended way to install the Rover SDK is via SwiftPM.

In Xcode, in your Project Settings, under Package Dependencies, add a new dependency with the URL of this repository: https://github.com/roverplatform/rover-ios.

Note that as of Xcode 13, you have to type the repository URL into the search box and press return.

SwiftPM Repo Dialog Box

Leave the dependency rule at the default, "Up To Next Major Version". Rover follows the standard semver semantic versioning rules.

Then, in the subsequent dialog box, choose the Package Products (frameworks) you wish to use.

SwiftPM Target Dialog Box

Initialize the Rover SDK

The shared Rover instance is initialized with a set of assemblers. Each assembler has its own parameters but the only one that is required is the accountToken parameter on the DataAssembler.

You can learn more about assemblers and their parameters at Customizing Services.

You can find your accountToken token in the Rover Settings app. Find the token labelled "SDK Token" and click the icon next to it to copy it to your clipboard.

Settings App

From within your application(_:didFinishLaunchingWithOptions:) method call the Rover.initialize(assemblers:) method passing in the assemblers for each of the Rover modules you want to use. Replace YOUR_SDK_TOKEN in the below code sample with the token you copied from the Rover Settings app.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // ...
    // Initialize Rover with its modules
    Rover.initialize(assemblers: [
        FoundationAssembler(),
        DataAssembler(accountToken: "YOUR_SDK_TOKEN"),
        UIAssembler(),
        ExperiencesAssembler(),
        NotificationsAssembler(),
        LocationAssembler(),
        DebugAssembler()
    ])
    return true
}