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.0 or later
- Xcode 26 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:
2
Select the Uplink product
Choose the
Uplink library product and add it to your app target. It bundles its MuppetIOS browser engine dependency, so you only link one product.Choose Uplink-Dynamic instead only when your integration requires dynamic frameworks.3
Import the module
Package.swift file:
Quick example
Creating a worker
Worker(controller:)
Worker is an actor. Its initializer is async and binds the worker 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).
controller: TheUIViewControllerthat will host the SDK’s web view
Uplink object to configure first.
Obtaining a session
Your backend creates a session using the JavaScript SDK’suplink.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.
Connecting and accepting
worker.connect(session:)
Connects the worker to an Uplink session.
session: The session URL provided by your backend
UplinkError.unableToConnectToUplink if the session can’t be joined.
worker.accept()
Begins accepting commands from the JavaScript SDK client. accept() does not throw, and it suspends until the worker closes, so call it from a Task if you want the rest of your app to continue running.
Watching events
worker.watch(_:)
Registers a callback for events the worker emits. Call it before connect so you don’t miss the connection events.
Event. Match on the ones you care about:
Cleanup
worker.close()
Closes the worker and releases its resources. Returns once the session has finished closing.
Debug logging
UplinkDebug.setDebug(isEnabled:forwardLogs:) turns on verbose SDK logging and optionally forwards each line to your own logger.
Complete example
A minimalUIViewController that starts an Uplink worker when it appears:
Related
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