01.Add the package
swift
// In Package.swift or Xcode: File > Add Packages .package(url: "https://github.com/apext/orbit-swift", from: "1.0.0")
02.Initialize at app launch
swift
import Orbit
@main
struct MyApp: App {
init() {
OrbitAnalytics.shared.configure(
apiKey: "apext_sk_live_...",
baseUrl: URL(string: "https://apext.dev/orbit")!,
serviceName: "my-ios-app",
autoScreenTracking: true,
enableCrashTracking: true
)
}
}03.Track an event
swift
OrbitAnalytics.shared.track(
"user_signed_up",
userId: "user_123",
properties: ["plan": "pro"]
)04.Automatic crash capture
swift
// The AutoTracker installs an NSSetUncaughtExceptionHandler // when enableCrashTracking = true (default). NSExceptions are // automatically sent with call stack and context. // // No manual setup needed. Chained with any existing handler.
Need help? support@apext.dev