B
BlocLinks
/Docs
Dashboard →
Docs/SDK/iOS

iOS SDK

Swift / ObjC

Native iOS SDK for BlocLinks deep linking and attribution.

Installation

Add via Swift Package Manager:

swift
// In Xcode: File → Add Package Dependencies
// URL: https://github.com/bloclinks/bloclinks-ios

Or add to your Package.swift:

swift
.package(url: "https://github.com/bloclinks/bloclinks-ios", from: "1.0.0")

Setup

Initialize in your AppDelegate or SwiftUI App:

AppDelegate.swift
import BlocLinks

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
  func application(_ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    BlocLinks.initialize(apiKey: "bl_live_YOUR_API_KEY")
    return true
  }
}

Getting the deep link path

swift
let deepPath = BlocLinks.getDeepLinkPath()
// Returns: "/product/123" | "/referral/abc" | nil

if let path = deepPath {
  // Navigate to the correct screen
  navigateTo(path: path)
}

SwiftUI example

BlocLinksApp.swift
import SwiftUI
import BlocLinks

@main
struct BlocLinksApp: App {
  @State private var initialPath: String? = nil

  init() {
    BlocLinks.initialize(apiKey: "bl_live_YOUR_API_KEY")
  }

  var body: some Scene {
    WindowGroup {
      ContentView(initialPath: BlocLinks.getDeepLinkPath())
    }
  }
}
Note: iOS SDK is in beta. Contact support@bloclinks.cc for early access.