Initializing the SDK
Initialize OnsideKit, register your callback URL scheme, and forward incoming URLs so the app-to-app login flow can complete.
Last updated
Was this helpful?
Was this helpful?
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>com.yourapp.onside</string>
</array>
</dict>
</array>// AppDelegate.swift
import UIKit
import OnsideKit
@main
final class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
Onside.initialize()
// Use the exact same scheme you declared in step 2.
Onside.callbackScheme = "com.yourapp.onside"
return true
}
}Onside.initialize(disableSSLPinning: Bool = false, storeKitConfigurationName: String? = nil)@MainActor static func handle(url: URL) -> Bool// AppDelegate.swift
import OnsideKit
extension AppDelegate {
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
if Onside.handle(url: url) {
return true
}
// Handle your own URLs here…
return false
}
}// SceneDelegate.swift
import OnsideKit
extension SceneDelegate {
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let url = URLContexts.first?.url else { return }
if !Onside.handle(url: url) {
// Handle your own URLs here…
}
}
}// YourApp.swift
import SwiftUI
import OnsideKit
@main
struct YourApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL { url in
if !Onside.handle(url: url) {
// Handle your own URLs here…
}
}
}
}
}