Skip to main content
The Uplink iOS SDK embeds a worker inside your iOS app, making the device controllable from server-side code written with the JavaScript SDK. Use it when you want Uplink automation to run inside your own branded app.
Key concepts:
  • Device: A physical iOS device running your app
  • Worker: A worker created by the Uplink SDK inside your app (one app can create multiple workers)
  • Session: An authenticated connection that pairs your worker with a JavaScript SDK client

Requirements

  • iOS 15.1 or later
  • Swift 6.0 or later
  • Xcode 16 or later

Installation

The iOS SDK is distributed via Swift Package Manager.
1

Add the package

In Xcode, go to File → Add Package Dependencies… and enter:
https://github.com/uplink-code/uplink-ios-public
2

Select the UplinkIOS product

Choose the UplinkIOS library product and add it to your app target.
3

Import the module

import UplinkIOS
If you manage dependencies with a Package.swift file:
dependencies: [
    .package(url: "https://github.com/uplink-code/uplink-ios-public", from: "0.0.0-alpha10")
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "UplinkIOS", package: "uplink-ios-public")
        ]
    )
]

Quick example

import UIKit
import UplinkIOS

@MainActor
func startUplink(in viewController: UIViewController, session sessionUrl: String) async throws {
    let uplink = Uplink()
    let worker = uplink.worker(controller: viewController)

    try await worker.connect(session: sessionUrl)

    Task {
        try await worker.accept()
    }
}

Initialization

Create a single Uplink instance in your app and use it to spawn workers.
let uplink = Uplink()
Creates a new Worker bound to a UIViewController. The SDK uses the controller to host its WKWebView, so pass the view controller that should own the SDK’s browser surface (typically the one currently on screen).
func worker(controller: UIViewController) -> Worker
Parameters:
  • controller: The UIViewController that will host the SDK’s web view
Returns: A new Worker ready to connect to a session
let worker = uplink.worker(controller: self)
Keep a strong reference to the Worker for as long as the connection is active. If the worker is deallocated, the session will close.

Obtaining a session

Your backend creates a session using the JavaScript SDK’s uplink.session() and delivers the resulting session URL to the app. How you deliver it — a backend API response, a universal link, a QR code — is up to you.
let sessionUrl: String = // from your backend, deep link, or QR code
See Sessions for how sessions are created on the server side.

Connecting and accepting

worker.connect(session:)

Connects the worker to an Uplink session.
func connect(session: String) async throws
Parameters:
  • session: The session URL provided by your backend
try await worker.connect(session: sessionUrl)

worker.accept()

Begins accepting commands from the JavaScript SDK client. accept() suspends until the worker closes, so call it from a Task if you want the rest of your app to continue running.
func accept() async throws
Task {
    try await worker.accept()
}

Cleanup

worker.close()

Closes the worker and releases its resources.
func close() async throws
try await worker.close()
Closing a worker ends its session. Any browsers the JavaScript SDK has launched on the worker will be terminated.

Complete example

A minimal UIViewController that starts an Uplink worker when it appears:
import UIKit
import UplinkIOS

final class UplinkViewController: UIViewController {
    private let uplink = Uplink()
    private var worker: Worker?

    func start(sessionUrl: String) {
        Task { @MainActor in
            let worker = uplink.worker(controller: self)
            self.worker = worker

            do {
                try await worker.connect(session: sessionUrl)
                try await worker.accept()
            } catch {
                print("Uplink worker ended: \(error)")
            }
        }
    }

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)

        Task { [worker] in
            try? await worker?.close()
        }
    }
}

Android SDK

Integrate Uplink into your Android app

JavaScript SDK

Control your worker from server-side code

Sessions

How sessions are created and secured

Core concepts

Architecture overview