Privacy-First Analytics
for Swift
Add analytics to your iOS or macOS app in 2 lines of code. No IDFA, no IDFV, no device fingerprints. Works with SwiftUI and UIKit.
import RespectlyticsSwift
// 1. Configure once at app launch
Respectlytics.configure(apiKey: "your-api-key")
// 2. Track events anywhere
Respectlytics.track("purchase_completed")
Installation
Add the SDK using Swift Package Manager
Option 1: Xcode UI
In Xcode, go to File β Add Package Dependencies and enter:
https://github.com/respectlytics/respectlytics-swift.git
Option 2: Package.swift
Add to your Package.swift dependencies:
dependencies: [
.package(url: "https://github.com/respectlytics/respectlytics-swift.git", from: "2.1.0")
]
Platform Requirements
Quick Start
Works with both SwiftUI and UIKit
SwiftUI App Lifecycle
import SwiftUI
import RespectlyticsSwift
@main
struct MyApp: App {
init() {
Respectlytics.configure(
apiKey: "your-api-key"
)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
UIKit App Delegate
import UIKit
import RespectlyticsSwift
@main
class AppDelegate: UIResponder,
UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions opts: ...
) -> Bool {
Respectlytics.configure(
apiKey: "your-api-key"
)
return true
}
}
Why Respectlytics for Swift?
Unlike Firebase Analytics, we help you avoid collecting data you don't need
Firebase Analytics
FirebaseAnalytics
- β οΈ Collects IDFA (with ATT prompt)
- β οΈ Collects IDFV persistently
- β οΈ Unlimited custom parameters (PII risk)
- β οΈ Complex Privacy Label requirements
- π CocoaPods/SPM with Google dependencies
Respectlytics
RespectlyticsSwift
- β No IDFA β no ATT prompt needed
- β No IDFV or device fingerprints
- β 5 fields only (API rejects extras)
- β Simple Privacy Label: "Not Linked"
- π‘οΈ Pure Swift, zero dependencies
API Reference
Simple by design. Just 3 methods.
| Method | Description |
|---|---|
configure(apiKey:)
|
Initialize the SDK. Call once at app launch |
track(_:)
|
Track an event. Custom properties not supported (by design) |
flush()
|
Force send queued events. Rarely neededβSDK auto-flushes |
Full SwiftUI Example
A complete SwiftUI app with analytics integration
import SwiftUI
import RespectlyticsSwift
@main
struct MyApp: App {
init() {
// Configure SDK at launch
Respectlytics.configure(apiKey: "your-api-key")
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
var body: some View {
VStack(spacing: 20) {
Button("Sign Up") {
Respectlytics.track("signup_started")
}
.buttonStyle(.borderedProminent)
Button("Make Purchase") {
Respectlytics.track("purchase_completed")
}
.buttonStyle(.borderedProminent)
}
.padding()
}
}
App Store Privacy Label
Simple disclosure β our SDK makes it easy
Data Type
Analytics
Linked to User
No
Used to Track
No
Privacy Architecture
Transparent about exactly what data is collected
β What We Store (5 fields)
-
event_nameThe action being tracked -
timestampWhen it happened -
session_idRAM-only, 2-hour rotation -
platformiOS, macOS, etc.
Country is derived server-side from IP, then IP is immediately discarded.
β What We DON'T Collect
-
β
IDFA
No ATT prompt needed
-
β
IDFV
No persistent vendor ID
-
β
IP addresses
Processed transiently only
-
β
Custom properties
API rejects extra fields
Our motto is Return of Avoidance (ROA) β the best way to protect sensitive data is to never collect it. Consult your legal team to determine your specific requirements.
Frequently Asked Questions
Does the SDK collect IDFA? βΌ
Does it work with SwiftUI? βΌ
@main App struct,
configure in your init(). For UIKit apps, configure in
application(_:didFinishLaunchingWithOptions:).
How do I fill out the App Store privacy label? βΌ
Which Apple platforms are supported? βΌ
How do I migrate from Firebase Analytics? βΌ
Analytics.logEvent() calls with
Respectlytics.track().
Remove any Analytics.setUserID() or Analytics.setUserProperty() calls β Respectlytics uses automatic session-based tracking.
See our migration guide for details.
Why can't I send custom properties? βΌ
Other SDKs: Flutter β’ React Native β’ Kotlin β’ Full Documentation
Ready to Add Analytics?
Get started in under 5 minutes. No credit card required.