Skip to documentation
SmartLinks Developers
Public SDK guides Read as Markdown ↗
Examples, not credentials. YOUR_API_KEY is a placeholder. Get your own key from your private app dashboard. This page never displays account keys.

Native iOS SDK

Use SmartLinksSDK for Swift iOS apps with native analytics, linking and engagement screens. This guide uses the published CocoaPods 2.0.2 release. Flutter apps should follow the Flutter guide instead of separately adding the full native UI SDK.

Install with CocoaPods

Add this inside your app target in the Podfile:

pod 'SmartLinksSDK', '~> 2.0.2'

Run pod install, then open the generated .xcworkspace. Match your deployment target and Swift version to the installed pod requirements.

The maintained source repository is smartlinks_ios on GitLab. Use the pod or that repository's release instructions rather than the obsolete GitHub URL from older examples.

Initialize

In your app startup code, before calling other SmartLinks methods:

import SmartLinksSDK

SmartLinks.initialize(
    apiKey: "YOUR_API_KEY",
    debugMode: false
)

For a development build you may enable debug mode temporarily. Keep it disabled in release builds. Replace the key only in your own configuration and never publish it in a sample repository.

Send an event

SmartLinks.analytics.sendEvent(
    "integration_test",
    params: ["screen": "home"]
)

Confirm the event appears under the correct app in the private dashboard. A local method call is not a delivery receipt.

Universal Links

  1. In Xcode, add Signing & Capabilities → Associated Domains.
  2. Add applinks:smartlinks.live, or your configured link domain.
  3. Check your Apple Team ID and bundle identifier in the private SmartLinks app configuration.
  4. Forward links from your app lifecycle into the SDK and handle the returned route.

For SwiftUI, add link handling to your existing root view:

.onOpenURL { url in
    SmartLinks.handleUniversalLink(url)
}
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { activity in
    if let url = activity.webpageURL {
        SmartLinks.handleUniversalLink(url)
    }
}

Register your application's route handler after initialization:

SmartLinks.analytics.getLink { route in
    guard let route = route else { return }
    // Validate the destination and navigate when your UI is ready.
}

UIKit apps should forward the URL from their AppDelegate or SceneDelegate lifecycle. Test the exact public link on a real device, both with the app installed and through the intended install flow.

Optional screens and services

SmartLinks.openFeedback(from: viewController), SmartLinks.openApps(from: viewController), SmartLinks.community.open(from: viewController) and SmartLinks.blogs.open(from: viewController) present native engagement screens. Use an active presenting view controller.

Purchase verification requires real StoreKit purchase data and the matching private store configuration. AI Gateway must be enabled in the dashboard. Do not place Apple credentials or AI provider keys in the app.

See API keys and security for troubleshooting and the 2.0.2 source documentation for module details.