Docs

iOS SDK

The Lander Swift package receives, resolves and creates Lander links in your native iOS app, and reports conversions.

Start a trial before using the SDK

SDK calls require an active trial or subscription. If billing is inactive, the API returns 402 subscription_required. Open your workspace's Billing page to start a trial or restore access. Existing short links continue redirecting.

Lander is the native iOS SDK for Lander, written in Swift. It takes every link that opens your app (Universal Links and custom scheme URLs), asks Lander what the link means, and hands your app one tidy LanderLink with the route to open and the data you attached to it.

AcmeShopApp.swift
import Lander
import SwiftUI

@main
struct AcmeShopApp: App {
  init() {
    try? Lander.initialize(apiKey: "pk_live_...")
  }

  var body: some Scene {
    WindowGroup {
      ContentView()
        .onOpenURL { Lander.handle(url: $0) }
        .onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { Lander.handle(userActivity: $0) }
        .task {
          for await link in Lander.deepLinks {
            router.open(link.route, link: link)
          }
        }
    }
  }
}

That is the whole integration for most apps. The rest of this section explains each piece.

What you get

  • One stream for every link. Cold start, warm start and deferred links (after an install) all arrive on Lander.deepLinks, an AsyncStream<LanderLink>. Prefer closures? Lander.onDeepLink { link in ... } does the same on the main actor.
  • Nothing lost at startup. Links that arrive before anything listens are buffered and replayed in order, so you can start listening whenever your navigation is ready.
  • No double navigation. The link that launched the app is delivered exactly once, whether you read it from the stream or from Lander.initialLink().
  • Honest attribution. Every link says how sure Lander is: .deterministic, .probabilistic or .unattributed.
  • Unknown links still arrive. A URL Lander does not know (or cannot reach because the device is offline) still reaches your app with its raw URL.
  • Short links from the app. Lander.createLink makes a shareable link for invite and share flows.
  • Conversions that survive offline. Lander.trackEvent writes to an on device queue and sends in batches with retries and deduplication.
  • Never blocks launch. initialize returns at once; the network work happens in the background.
  • Privacy first. A random install ID, no fingerprinting, no advertising IDs, no pasteboard reads. A privacy manifest is bundled.
  • Modern Swift. Swift 6 with strict concurrency, async/await, every public type Sendable. No dependencies.

The public API at a glance

MemberWhat it does
Lander.initialize(apiKey:)Starts the SDK. Call once, at launch. Returns immediately.
Lander.handle(url:), Lander.handle(userActivity:)Hand a URL or Universal Link that opened the app to Lander.
Lander.deepLinksAsyncStream of every LanderLink the app receives.
Lander.onDeepLink { }The same, as a closure called on the main actor.
Lander.initialLink()The link that launched the app (or a deferred link), once.
Lander.claimHandoff(userId:)After sign in, returns a link your backend handed off to that user.
Lander.createLink(...)Creates a short link, returns a LanderShortLink.
Lander.trackEvent(_:properties:linkId:)Records a custom conversion event. Fire and forget.
Lander.installIDThe random ID of this install.

Full signatures are in the API reference.

How a tap becomes a screen

  1. Someone taps https://acme.golander.link/p-123.
  2. iOS sees that your app has claimed the domain (Lander hosts the apple-app-site-association file for you) and opens the app instead of Safari.
  3. iOS hands the link to your app (.onContinueUserActivity in SwiftUI, or your app or scene delegate), and you pass it to Lander.handle(userActivity:).
  4. The SDK calls POST /v1/sdk/resolve on api.golander.link. Lander records the open and answers with the link's route (/product/123), params and attribution labels.
  5. Lander.deepLinks emits a LanderLink, and your app opens link.route.

If the app was not installed, Lander sends the person to the App Store and, where it can do so honestly, gives the link back on first launch. See Deferred links.

Requirements

Minimum
iOS15.0
Xcode16 (Swift 6 toolchain)
Swift language mode5 or 6. The package itself builds in Swift 6 mode.

The current SDK version is 0.1.0. Building a Flutter app? Use the Flutter SDK instead.

Get the package

Add https://github.com/SwiftwareIO/lander_ios with Swift Package Manager, starting from version 0.1.0, and use import Lander. See Installation.

Next steps

On this page