All Integrations
LanguagesSwift package

Swift Integration

Instrument iOS apps and server-side Swift with one Swift Package Manager dependency. URLSession tracing, Vapor request spans, Swift concurrency metrics, and crash reporting with symbolicated stack traces.

Setup

How It Works

01

Add the Swift Package

Add the TigerOps Swift package via Swift Package Manager. In Package.swift: .package(url: "https://github.com/tigerops/tigerops-swift.git", from: "0.1.0"). For iOS apps, add it through Xcode via File > Add Package Dependencies.

02

Initialize in App Entry Point

For iOS, call TigerOps.configure() in your App initializer or AppDelegate.application(_:didFinishLaunchingWithOptions:). For Vapor, register the TigerOpsProvider in your configure.swift. The SDK auto-detects the runtime target.

03

Set API Key & Service Name

Provide your TIGEROPS_API_KEY and service name in your app's Info.plist (iOS) or as environment variables (Vapor/Linux). On iOS the key is read from the TigerOps dictionary in Info.plist to avoid committing secrets to source control.

04

Traces, Crashes & Runtime Metrics

TigerOps begins capturing URLSession network traces, Vapor HTTP request spans, Swift actor message timings, async/await task durations, memory footprint, and crash reports with symbolicated stack traces within seconds of launch.

Capabilities

What You Get Out of the Box

URLSession Network Tracing

Every URLSession data task, download task, and WebSocket session is auto-instrumented. Spans include URL, HTTP method, response status, DNS resolution time, TLS handshake duration, and bytes transferred. Works with async/await URLSession API.

Vapor Route & Middleware Spans

Vapor HTTP requests create root spans with route path, HTTP method, status code, and controller action. Middleware execution and responder chain timings are captured as sequential child spans. Fluent ORM queries are auto-traced.

Swift Concurrency Task Metrics

Swift async/await tasks and actors are tracked with scheduling latency, execution duration, and cancellation events. Task group parallelism and cooperative thread pool saturation are emitted as runtime metrics.

iOS App Performance Monitoring

TigerOps measures iOS app launch time (pre-main and post-main phases), view controller load and appear durations, SwiftUI body render counts, Core Data fetch timings, and background task execution windows.

Crash Reporting & Symbolication

Unhandled exceptions and EXC_BAD_ACCESS crashes are captured with full symbolicated stack traces. Crash reports include device model, OS version, available memory, and the last 50 breadcrumb events before the crash.

Fluent ORM & Redis Query Spans

Database queries via Vapor's Fluent ORM (PostgreSQL, MySQL, SQLite) create child spans with model name, query type, execution time, and row count. Redis commands executed via RediStack are traced with key name and command type.

Configuration

Install & Initialize

One SPM package. Works for iOS apps and Vapor servers alike.

Package.swift + configure.swift
// Package.swift
dependencies: [
    .package(url: "https://github.com/tigerops/tigerops-swift.git", from: "0.1.0")
],
targets: [
    .target(name: "App", dependencies: [
        .product(name: "TigerOps", package: "tigerops-swift"),
        .product(name: "TigerOpsVapor", package: "tigerops-swift"),
    ])
]

// Vapor: configure.swift
import TigerOpsVapor

public func configure(_ app: Application) async throws {
    app.tigerops.configure(
        apiKey: Environment.get("TIGEROPS_API_KEY")!,
        serviceName: "my-vapor-app",
        environment: app.environment.name
    )
    // All routes are now auto-traced
    try routes(app)
}

// iOS: App.swift
import TigerOps
import SwiftUI

@main
struct MyApp: App {
    init() {
        TigerOps.configure(
            apiKey: Bundle.main.infoDictionary?["TIGEROPS_API_KEY"] as! String,
            serviceName: "my-ios-app"
        )
    }
    var body: some Scene {
        WindowGroup { ContentView() }
    }
}

// Custom span in an async function
import TigerOps

func fetchUserProfile(userId: String) async throws -> UserProfile {
    try await TigerOps.span("user.fetch") { span in
        span.setAttribute("user.id", userId)
        let profile = try await apiClient.get("/users/\(userId)")
        span.setAttribute("user.tier", profile.tier)
        return profile
    }
}
FAQ

Common Questions

Which Swift and iOS versions are supported?

Swift 5.7 and later are supported. iOS 14+, macOS 12+, tvOS 14+, and watchOS 7+ are supported for the iOS SDK. Server-side Swift on Linux (Ubuntu 20.04, 22.04) with Swift 5.8+ is fully supported for Vapor applications.

Does TigerOps affect App Store submission or privacy labels?

TigerOps collects only performance telemetry: timing, error messages, and device metadata. No user PII or content is collected by default. You will declare "Performance Data" and "Crash Data" under the Analytics category in your App Store privacy nutrition labels.

How does TigerOps handle Swift actor isolation?

The TigerOps Swift SDK is actor-safe. The span context is stored in a TaskLocal value which Swift propagates automatically across actor hops and async calls. There are no shared mutable state issues when tracing code that crosses actor boundaries.

Can I use TigerOps with SwiftUI previews and simulators?

Yes. TigerOps detects the simulator environment via TARGET_OS_SIMULATOR and tags spans with environment: simulator. Previews are also detected and telemetry is suppressed by default to avoid polluting production metrics with preview renders.

Does TigerOps support Bitcode and dSYM uploads for symbolication?

TigerOps provides a CLI tool (tigerops-cli upload-dsym) for uploading dSYM files from your Xcode build archive. A build phase script is available to automate uploads on every release build. Bitcode re-compilation dSYMs from App Store Connect are also supported.

Get Started

Full Swift Observability in One SPM Package

URLSession traces, Vapor spans, Swift concurrency metrics, and symbolicated crash reports for iOS and server-side Swift.