Respectlytics Respect lytics
Menu
Swift SDK v2.1.0

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.

MyApp.swift
import RespectlyticsSwift

// 1. Configure once at app launch
Respectlytics.configure(apiKey: "your-api-key")

// 2. Track events anywhere
Respectlytics.track("purchase_completed")
2 lines
to integrate
5 fields
stored only
5 platforms
iOS, macOS, tvOS, watchOS, visionOS
0 IDFA
collected

Installation

Add the SDK using Swift Package Manager

Option 1: Xcode UI

In Xcode, go to File β†’ Add Package Dependencies and enter:

URL
https://github.com/respectlytics/respectlytics-swift.git

Option 2: Package.swift

Add to your Package.swift dependencies:

Swift
dependencies: [
    .package(url: "https://github.com/respectlytics/respectlytics-swift.git", from: "2.1.0")
]

Platform Requirements

βœ“ iOS 15.0+
βœ“ macOS 12.0+
βœ“ tvOS 15.0+
βœ“ watchOS 8.0+
βœ“ visionOS 1.0+
βœ“ Swift 5.9+

Quick Start

Works with both SwiftUI and UIKit

SwiftUI App Lifecycle

MyApp.swift
import SwiftUI
import RespectlyticsSwift

@main
struct MyApp: App {
    init() {
        Respectlytics.configure(
            apiKey: "your-api-key"
        )
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

UIKit App Delegate

AppDelegate.swift
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

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

ContentView.swift
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_name The action being tracked
  • timestamp When it happened
  • session_id RAM-only, 2-hour rotation
  • platform iOS, 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? β–Ό
No. The Respectlytics Swift SDK never collects IDFA, IDFV, device fingerprints, or any persistent identifiers. This means you don't need to show the App Tracking Transparency (ATT) prompt for Respectlytics. Session IDs are stored only in RAM and rotate every 2 hours or on app restart.
Does it work with SwiftUI? β–Ό
Yes! The SDK works with both SwiftUI and UIKit. For SwiftUI apps using the @main App struct, configure in your init(). For UIKit apps, configure in application(_:didFinishLaunchingWithOptions:).
How do I fill out the App Store privacy label? β–Ό
Select "Analytics" as the data type, then check "Not Linked to User" and "Not Used to Track User". Our SDK doesn't collect data linked to user identity. See our complete privacy label guide for step-by-step instructions.
Which Apple platforms are supported? β–Ό
The SDK supports iOS 15+, macOS 12+, tvOS 15+, watchOS 8+, and visionOS 1.0+. It works on both device and simulator, and supports Swift 5.9+.
How do I migrate from Firebase Analytics? β–Ό
Replace your 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? β–Ό
By design. Custom properties are the #1 source of accidental PII leaks in analytics. Our API rejects any fields not on the strict 4-field allowlist, making it technically difficult to accidentally collect data you don't need. Read why we killed custom properties.

Other SDKs: Flutter β€’ React Native β€’ Kotlin β€’ Full Documentation

Ready to Add Analytics?

Get started in under 5 minutes. No credit card required.