iOS SDK
The Kixo iOS SDK supports Swift 5.9+ and iOS 15+. Install it via Swift Package Manager.
Installation
Swift Package Manager
In Xcode, go to File > Add Package Dependencies and enter:
text
https://github.com/kixo/kixo-ios-sdkConfigure
Initialize Kixo in your AppDelegate or SwiftUI App struct:
swift
import Kixo
@main
struct MyApp: App {
init() {
Kixo.configure(projectId: "YOUR_PROJECT_ID", apiKey: "YOUR_API_KEY")
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}Auto-tracking
The iOS SDK automatically captures the following events with no additional code:
screen_view-- UIKit view controller appearances and SwiftUI navigationsession_start/session_endtap-- button taps and gesture recognizerserror-- uncaught exceptions and crash reportsnetwork-- HTTP request performance (opt-in)performance-- app launch timing
Custom events
swift
Kixo.track("purchase", properties: [
"product": "Pro Plan",
"amount": 49.99,
])Identify users
swift
Kixo.identify(userId: "user_123", traits: [
"name": "Jane Doe",
"email": "[email protected]",
])SwiftUI integration
Track screen views automatically in SwiftUI using the .kixoScreen() view modifier:
swift
struct HomeView: View {
var body: some View {
VStack {
Text("Welcome")
}
.kixoScreen("HomeView")
}
}Tip
The .kixoScreen() modifier fires a screen_view event when the view appears, with the screen name you provide.
Feature flags
swift
let variant = Kixo.getFeatureFlag("new_checkout")
if variant == "enabled" {
showNewCheckout()
}Reset
Clear user identity on logout:
swift
Kixo.reset()