SPM Compatible
iOS 14.0+
Swift 5.9+
v1.1.0
Valyrix iOS SDK (Swift & SwiftUI)
High-performance native telemetry, automatic screen tracking, crash reporting, and real-time feature flags for iOS applications.
1 Installation via Swift Package Manager
Valyrix is distributed as an ABI-stable pre-compiled binary XCFramework via Swift Package Manager:
1. In Xcode, select File > Add Package Dependencies...
2. Enter the repository URL:
https://github.com/valyrix-io/valyrix-ios-framework.git
3. Set Dependency Rule to "Up to Next Major Version" from 1.1.0
4. Link the "Valyrix" library to your app target
dependencies: [
.package(url: "https://github.com/valyrix-io/valyrix-ios-framework.git", from: "1.1.0")
]
2 Initialize the SDK
Initialize Valyrix in your SwiftUI App entrypoint or UIKit AppDelegate:
import SwiftUI
import Valyrix
@main
struct MyApp: App {
init() {
let config = ValyrixConfig(
writeKey: "SDK-your-project-id-write-key",
serverUrl: "https://valyrix-api.fly.dev",
flushIntervalSeconds: 30,
trackLifecycleEvents: true,
trackScreenViews: true,
enableCrashReporting: true,
enableFeatureFlags: true
)
Valyrix.initialize(config: config)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
import UIKit
import Valyrix
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions options: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let config = ValyrixConfig(
writeKey: "SDK-your-project-id-write-key",
serverUrl: "https://valyrix-api.fly.dev"
)
Valyrix.initialize(config: config)
return true
}
}
3 Identify Users
Bind anonymous device sessions to an authenticated user identity when a user logs in:
Valyrix.identify(userId: "usr_99812", traits: [
"email": "[email protected]",
"plan": "enterprise",
"organization": "Acme Corp"
])
4 Track Custom Events
Dispatch behavioral and business telemetry with structured custom properties:
Valyrix.track("order_completed", properties: [
"order_id": "ord_88219",
"total_cents": 4999,
"currency": "USD",
"item_count": 3,
"payment_method": "apple_pay"
])
5 Feature Flags & Remote Config
Check dynamic feature flags with sub-millisecond local cache evaluation:
if Valyrix.isFeatureEnabled("new_checkout_flow", defaultValue: false) {
// Render upgraded checkout flow
} else {
// Render standard checkout flow
}