Skip to main content
Documentation
SDKsiOS

iOS API Reference

The complete Swift API reference for the WarpLink iOS SDK: initialization, deep link handling, and attribution methods, with signatures and examples.

The main entry point. All methods are static.

Properties

PropertyTypeDescription
sdkVersionStringThe current SDK version ("1.4.1").
isConfiguredBoolWhether configure() has been called. Thread-safe.
isApiKeyValidBool?The server's key validation verdict: true, false (rejected or revoked), or nil if not yet determined.
attributionResultWarpLinkDeepLink?The cached result of the last deferred deep link check.
isAttributionCompleteBoolWhether the deferred attribution check has finished for this install.
deferredCheckStatusDeferredCheckStatusWhere the deferred check stands, read without sending a request. It tells a skipped check from no match. See DeferredCheckStatus.
lastTetherTestReceiptString?The receipt of the last Tether test code the server took. The SDK forgets it when the app starts, and clearAttribution() clears it.

configure(apiKey:options:)

Initialize the SDK. Must be called before any other SDK methods.

ParameterTypeDescription
apiKeyStringYour WarpLink SDK key (wl_live_ for release builds or wl_test_ for debug builds, then 32 alphanumeric chars). Create it in the dashboard under Keys > SDK keys. An API key is rejected by install attribution.
optionsWarpLinkOptions?Optional configuration overrides, including the onLink callback and opt-out flags.

Validates the key format locally, then performs async server-side validation via /sdk/validate. The validation result is cached for 24 hours.

Call it once at startup. A second call with the same key and equal options keeps the running session and its deferred check, and only takes the new onLink. A different key or different options start a new session, and abandon a check still in flight.

When options.onLink is set, configure() also wires up cold start, warm start, and the deferred deep link check. The single callback receives every resolved link (a tap or a deferred install match). Set autoDeepLinkHandling or autoDeferredCheck to false to disable either piece and drive it with the manual methods below.

continue(_:) and open(_:)

Forward an incoming Universal Link to the SDK from your scene or app delegate. The SDK resolves it and dispatches to onLink. Use these when you keep your own delegate instead of the drop-in WarpLinkSceneDelegate / WarpLinkAppDelegate. continue(_:) extracts webpageURL and forwards it to open(_:).

Both return true if the URL was a WarpLink link the SDK will handle: a WarpLink domain and a path of exactly one segment, which is what a slug always is. A custom domain counts as a WarpLink domain once you declare it in linkDomains or WarpLinkDomains. They return false (and do nothing) when configure() has not run, when autoDeepLinkHandling is disabled, when the URL is not on a WarpLink domain, or when the path is not a single segment. By default your app is associated with every path on the domain, so pass every URL here and route the ones that return false with your own router.

isWarpLinkURL(_:)

Check whether a URL is a WarpLink link, without resolving it. Useful when a host has its own router and needs to decide whether to hand a URL to WarpLink at all, since open(_:) and continue(_:) resolve as a side effect (claiming the tap, deduping, calling the API). Uses the same WarpLink domain and single-path-segment rule as open(_:)/continue(_:).

ParameterTypeDescription
urlURLThe URL to check.

Resolve an incoming Universal Link URL to a deep link.

ParameterTypeDescription
urlURLThe Universal Link URL received by the app.
completion(Result<WarpLinkDeepLink, WarpLinkError>) -> VoidCalled on the main thread.

Errors: .notConfigured, .invalidURL, .linkNotFound, .passwordRequired, .networkError, .serverError, .invalidApiKey, .decodingError

checkDeferredDeepLink(completion:)

Check for a deferred deep link on first launch. Returns nil if no match found. Called automatically by configure() unless autoDeferredCheck is false.

ParameterTypeDescription
completion(Result<WarpLinkDeepLink?, WarpLinkError>) -> VoidCalled on the main thread.

On first launch, collects device signals (preferred language, timezone offset, IDFV) and sends them to the attribution API. The server derives the IP and computes the match key. On subsequent launches, returns the cached result.

"First launch" means the first launch of the current install. A reinstall is a new install and runs the check again, with is_reinstall set on the request. See App Reinstall.

Errors: .notConfigured, .networkError, .serverError, .invalidApiKey, .keyAppMismatch, .decodingError

redeemInvitation(text:completion:)

Redeem a referral invitation the person pasted. Call it from a user action with the text the system paste control hands you. This call reads nothing from the pasteboard. The paste button reads it only on a tap, automatic mode reads once on first open, and on call mode reads when your app calls readTether.

ParameterTypeDescription
textStringThe pasted text.
completion(Result<WarpLinkDeepLink?, WarpLinkError>) -> VoidCalled on the main thread. .success(link) is a match, also cached as attributionResult. .success(nil) means the text was not an invitation or matched nothing.

An invitation that is invalid or expired fails with .serverError and a message that says how to open the link again. After a network failure the SDK keeps the invitation and tries again on a later launch, a bounded number of times. Skipping this call, or any failure, leaves the app fully usable.

WarpLinkPasteButton (SwiftUI, iOS 16) and WarpLinkUIPasteButton (UIKit, iOS 16) wrap the system paste control and call this method with the text it returns. Both take an onResult closure with the same Result. See Referral Invitations.

Errors: .notConfigured, .serverError, .networkError

claimReferral(installerId:completion:)

Credit the referral behind this install to the person who just signed up. installerId is your own stable id for them, 1 to 128 characters. The call is safe to repeat: the same id gets the same answer and is never credited twice. A status of .none is an ordinary answer, not an error.

ReferralClaimResult carries these properties:

PropertyTypeDescription
statusStatus.claimed, .flagged, .ignored or .none.
referralIdString?The referral's id. nil for .none.
linkId, linkUrlString?The link the referral came from.
matchMethodMatchMethod?How the referral was matched.
isExactBooltrue when the match rests on exact evidence.
matchConfidenceDouble?The confidence of an estimated match.
flags[String]Reasons for review, for example outside_window.
duplicateOfString?For .ignored, the referral that holds the credit.
updatedBooltrue when this call replaced an estimate with an exact match.
replayStateReplayState?.original or .replayed.

Errors: .notConfigured, .networkError, .serverError, .invalidApiKey, .keyAppMismatch. An empty or over-long installerId fails with .serverError and status code 400.

readTether(completion:)

Reads a Tether code from the clipboard now and sends it to the server. It works in every tetherReadMode. iOS may show its paste prompt, and the person can refuse it. Only text that is a WarpLink code is sent. completion is always called on the main queue.

Results: .success(.matched(link)), .success(.noCode(reason)), .success(.unusable) and .success(.test(receipt:)). See TetherReadResult. Errors: .notConfigured before configure, and a refused code, for example one that is invalid or expired, and a network error. See Tether.

clearAttribution()

Forgets this install's attribution so you can test a first launch again without deleting the app: the cached match, the attempt and completed markers, and any held referral invitation. Only the device is cleared. Server records are not deleted.

Test only. With a wl_live_ key this does nothing and returns .success, so it never erases a live install's attribution. With a wl_test_ key and autoDeferredCheck on, a check already in flight is discarded and a new check starts. A match from it reaches onLink.

Errors: .notConfigured before configure. .decodingError with the message "Could not clear stored attribution data." when a stored item could not be deleted and some state may remain. Calling again is safe.


WarpLinkOptions

PropertyTypeDefaultDescription
apiEndpointString"https://api.warplink.app/v1"API endpoint URL.
debugLoggingBoolfalseEnable [WarpLink] console logging.
autoDeepLinkHandlingBooltrueAutomatically resolve forwarded Universal Links and dispatch to onLink.
autoDeferredCheckBooltrueAutomatically run the deferred deep link check on first launch.
linkDomains[String][]Extra hosts the SDK should treat as yours, for links served from a custom domain.
tetherReadModeTetherReadMode.pasteButtonHow the SDK reads a Tether code from the clipboard. See TetherReadMode.
onLink(@MainActor @Sendable (Result<WarpLinkDeepLink?, WarpLinkError>) -> Void)?nilSingle callback for cold start, warm start, and deferred results. Disambiguate with isDeferred.

From SDK 1.4.0, the onLink parameter of init is @MainActor, so a handler can call your own main-actor code and compile under Swift 6 without MainActor.assumeIsolated. The stored options.onLink property keeps its @Sendable type. Called from the main thread, it runs the handler at once. Called from another thread, it runs the handler on the main queue.

The match window is server-side (set per link in the dashboard), so there is no matchWindowHours option.

linkDomains and the WarpLinkDomains plist key

linkDomains is additive, never a replacement. The SDK recognizes the union of aplnk.to, linkDomains, the WarpLinkDomains string array in Info.plist, and the domains returned by /sdk/validate. The first three are known synchronously at configure(), so open(_:) claims a custom-domain link on the first launch instead of waiting for the server.

Entries are normalized: trimmed, lowercased, and reduced to a host if a full URL is given. A port is dropped, because the host of an incoming URL never carries one. Empty entries are dropped. A www. prefix is preserved, since it is a different host.

WarpLinkDomains is an array of strings. A single comma separated string is accepted too, because that is the row type Xcode's plist editor creates by default.


DeferredCheckStatus

Where the deferred check stands for this install. Read it with WarpLink.deferredCheckStatus. It sends no request. Every state except .checking comes from what the SDK stored, so a relaunch keeps it.

CaseMeaning
.notCheckedNo check has finished for this install. A failed check whose wait has passed also reads .notChecked, and the next one may send.
.checkingA check is running, or waiting for the app to come to the foreground.
.matchedThe check finished and found a link.
.noMatchThe check finished and the server found no link.
.waiting(retryAt: Date)An earlier check failed. The SDK sends nothing before retryAt.
.skippedOldInstallThe install is older than 30 days by default, so no request is sent.
.stoppedThe SDK gave up 3 days after the first failure by default. No request is sent.

A wl_test_ key never reports .waiting, .skippedOldInstall or .stopped. With debugLogging on, the SDK prints [WarpLink] Deferred check request: attempt <n>, raw signals <yes|no> for each request, and [WarpLink] Deferred check: <state> when a check ends. A waiting check prints Deferred check: waiting, retry at <ISO 8601 time>. See If your test did not match.


TetherReadMode

CaseMeaning
.pasteButtonThe default. The person taps the system paste control (WarpLinkPasteButton or WarpLinkUIPasteButton). The SDK never reads the clipboard by itself.
.automaticThe SDK reads the clipboard once during the first-launch check. iOS may show its paste prompt then.
.onCallThe SDK reads the clipboard only when your app calls readTether(completion:).

TetherReadResult

CaseMeaning
.matched(WarpLinkDeepLink)The code led to a link. It is also cached as attributionResult.
.noCode(TetherMissReason)No code was read, so nothing was sent. The reason goes with the next attribution request.
.unusableA code was sent and the server did not use it, or it led to no link. Let the person continue.
.test(receipt: String?)A test code reached the server. Nothing was recorded. The receipt is also in lastTetherTestReceipt.

TetherMissReason has the cases pasteNotAllowed, clipboardEmpty, inAppBrowser, expired, otherApp, linkEnded and olderSdk. This SDK reports pasteNotAllowed, clipboardEmpty and olderSdk. The server sets the others.

WarpLinkPasteButton

The SwiftUI paste button, iOS 16 and later. It wraps the system paste control. init(onResult:onTether:) reports each tap as a TetherReadResult in onTether. init(onResult:) accepts a referral invitation or a Tether code and reports the result as a Result<WarpLinkDeepLink?, WarpLinkError>, and every 1.3.0 call shape compiles unchanged. WarpLinkUIPasteButton is the UIKit view with the same onResult and onTether properties. See Tether.


PropertyTypeDescription
linkIdStringUnique link identifier.
destinationStringResolved destination URL.
deepLinkUrlString?iOS-specific deep link URL (e.g., myapp://path).
customParams[String: JSONValue]The query parameters of the link's destination URL on a direct open, empty on a deferred match. Read values with the typed accessors (.stringValue, .intValue, .doubleValue, .boolValue).
isDeferredBoolWhether resolved via deferred attribution.
matchTypeMatchType?.deterministic or .probabilistic.
matchConfidenceDouble?Confidence score (0.0–1.0). Use it for reporting.
matchGuaranteedBoolTrue only for an exact match, including an invitation token match. Use it to pick a destination, and keep sign-in on your own authentication.
attributionIdString?A stable id for this attribution. Send it to your backend to claim from there.
matchMethodMatchMethod?.installToken, .androidReferrer, .referrer, .deviceId, .linkOpen or .probabilistic. .referrer is a plain link ID from the Play install referrer. nil for a value this SDK does not know.
evidenceClassEvidenceClass?.exact, .estimated or .legacyLink. nil is never read as exact.
replayStateReplayState?.original for the first answer, .replayed for a repeat.
capturedParams[String: JSONValue]The allowed parameters captured when the link was tapped. Empty when there are none.
tappedAtString?When the link was tapped, as the server wrote it.

Access custom params with the typed accessors:


JSONValue

The value type of customParams, which the API returns as a JSON object. Read a value with its typed accessor rather than switching on the enum cases directly.

AccessorTypeDescription
stringValueString?The value if it is a JSON string.
intValueInt?The value if it is a JSON number representable as an Int.
doubleValueDouble?The value if it is a JSON number.
boolValueBool?The value if it is a JSON boolean.
arrayValue[JSONValue]?The value if it is a JSON array.
objectValue[String: JSONValue]?The value if it is a JSON object.
foundationValueAnyThe value lowered to a Foundation/JSON object graph (String/Int/Double/Bool/[String: Any]/[Any]/NSNull).

MatchType

CaseDescription
.deterministicResolved straight from a tapped link, or matched by the Play Install Referrer on Android. Confidence is always 1.0. A deferred install on iOS is deterministic only when it is matched by a referral invitation token.
.probabilisticMatched via enriched match key.

WarpLinkError

CaseDescription
.notConfiguredSDK used before configure().
.invalidApiKeyFormatKey format invalid (wl_live_ or wl_test_ + 32 chars).
.invalidApiKeyKey rejected by server.
.keyAppMismatchThe key is valid but tied to a different app. Use the SDK key created for this app.
.networkError(Error)Network request failed.
.serverError(statusCode: Int, message: String)API error response.
.invalidURLNot a recognized WarpLink domain.
.linkNotFoundLink not found or inactive.
.passwordRequiredLink is password protected, so it resolves to no destination and no platform URLs.
.decodingError(Error)Response parsing failed. clearAttribution() also fails with it, with the message "Could not clear stored attribution data.", when a stored item could not be deleted.

WarpLinkAppDelegate

Drop-in UIApplicationDelegate that forwards Universal Links to WarpLink. Use it directly, or subclass it and copy the two forwarding calls into your own delegate. No method swizzling is performed.

MemberDescription
application(_:continue:restorationHandler:)Forwards the incoming NSUserActivity to WarpLink.continue(_:).
application(_:open:options:)Forwards the incoming URL to WarpLink.open(_:).

WarpLinkSceneDelegate

Drop-in UIWindowSceneDelegate that forwards Universal Links to WarpLink, covering cold launch, warm continue, and URL contexts.

MemberDescription
windowUIWindow?, the scene's window.
scene(_:willConnectTo:options:)Forwards the connection options' user activities and URL contexts to WarpLink.continue(_:) and WarpLink.open(_:) on cold launch.
scene(_:continue:)Forwards the incoming NSUserActivity to WarpLink.continue(_:) on warm continue.
scene(_:openURLContexts:)Forwards each incoming URL context to WarpLink.open(_:).

Thread Safety

  • isConfigured is thread-safe (protected by NSLock)
  • All completion handlers are dispatched to the main thread
  • configure() can be called from any thread. Call it once at startup. A repeat call with the same key and options keeps the running session and only replaces onLink