Documentation / iOS

Integrate an iOS app with Logister.

iOS apps use the public Swift Package Manager repository https://github.com/taimoorq/logister-ios.git. The package exposes a Swift async client named Logister for errors, logs, metrics, transactions, spans, and check-ins.

Before you start

Create the project with the iOS integration type.

What you needWhy it matters
iOS project in LogisterLocks the project type so collected iOS data is interpreted as mobile telemetry.
Project API tokenAuthenticates requests from your iOS app to Logister.
Logister instance base URLBuilds the /api/v1/ingest_events endpoint used by the SDK.
Xcode or Swift Package ManagerResolves the public Git package and the Logister library product.
Optional GitHub App installationLets Logister use mobile source context and CI deployment records for source excerpts and deploy links.

What is supported

The iOS SDK starts with explicit, app-controlled telemetry.

Event familySwift APIWhere it appears
ErrorcaptureExceptionInbox and event detail with structured error and call stack context.
LogcaptureMessageActivity feed and event detail.
MetriccaptureMetricInsights, activity, and custom metric series.
TransactioncaptureTransactionPerformance and Insights for screen loads, sync work, and app jobs.
SpancaptureSpan with LogisterSpanRequest load waterfalls and detailed timing.
Check-incheckInMonitor status for recurring mobile work.
Source contextrepository, commitSHA, branch on LogisterClientSource lookup and deployment context when a GitHub repository is connected to the project.

Install

Add the package from GitHub with Swift Package Manager.

The current public iOS package version is 0.1.1. In Xcode, add the package URL https://github.com/taimoorq/logister-ios.git, choose the version rule your app prefers, and add the Logister product to your app target.

swift
dependencies: [
    .package(url: "https://github.com/taimoorq/logister-ios.git", from: "0.1.1")
]
swift
.product(name: "Logister", package: "logister-ios")

Configure

Create one client with app and release defaults.

Use the app bundle ID as service, include the app version/build in release, and attach safe default context that helps investigation.

swift
import Foundation
import Logister

let client = LogisterClient(
    apiKey: "your-project-api-token",
    baseURL: URL(string: "https://your-logister-host.example")!,
    environment: "production",
    release: "1.4.0+42",
    repository: "acme/ios-app",
    commitSHA: "4f8c2d1",
    branch: "main",
    service: Bundle.main.bundleIdentifier,
    defaultContext: [
        "app_version": .string("1.4.0"),
        "build_number": .string("42"),
        "device_model": .string("iPhone")
    ]
)

Keep real project API tokens out of source control. Prefer configuration, build-time secrets, or another runtime source that matches your app's security model. Use a build setting or generated file for commitSHA and branch so shipped events point at the source that produced the app build.

Source and deployments

Attach source context in the app, and record deployments from CI/CD.

The Swift client adds repository, commit_sha, and branch to event context when you set repository, commitSHA, and branch on LogisterClient. If the project is connected to the GitHub App, Logister can use those values to resolve stack frames and link to source.

Deployment records should be sent from CI/CD, not from the mobile app. After an App Store, TestFlight, Firebase App Distribution, internal, or enterprise deploy succeeds, POST a deployment envelope to /api/v1/deployments with the release, environment, repository, commit SHA, branch, and workflow URL.

json
{
  "deployment": {
    "release": "1.4.0+42",
    "environment": "production",
    "repository": "acme/ios-app",
    "commit_sha": "4f8c2d1a9b7e6c5d4a3b2c1d0e9f8a7b6c5d4e3f",
    "branch": "main",
    "release_tag": "ios-v1.4.0",
    "workflow_run_url": "https://github.com/acme/ios-app/actions/runs/123"
  }
}

Verify it

Send one test exception from a build using the same release. Open the event detail and check for source lookup status, deployment context, and GitHub links. If source is missing, confirm the GitHub App is installed, linked to the project, and the repository is connected; then check that CI sent a deployment record or the app event has repository and commit_sha.

Events

Send errors, logs, metrics, and transactions with async Swift.

swift
try await client.captureMessage(
    "Checkout opened",
    options: LogisterEventOptions(
        sessionID: "session-123",
        context: ["screen_name": .string("Checkout")]
    )
)

try await client.captureMetric("cart.item_count", value: 3, unit: "count")

try await client.captureTransaction(
    "screen.load",
    durationMs: 142.7,
    options: LogisterEventOptions(context: ["screen_name": .string("Checkout")])
)

do {
    try await runCheckout()
} catch {
    try await client.captureException(error)
}

Captured errors include structured exception context and call stack symbols. Metric values should use stable names and units, and transactions should describe app work such as screen loads, local processing, sync jobs, or API calls.

Spans and check-ins

Use spans for waterfalls and check-ins for recurring iOS work.

swift
try await client.captureSpan(
    LogisterSpan(
        traceID: "trace-123",
        spanID: "span-456",
        parentSpanID: "span-root",
        name: "GET /checkout",
        kind: "http",
        status: "ok",
        durationMs: 42.5,
        context: ["screen_name": .string("Checkout")]
    )
)

try await client.checkIn(
    "daily-sync",
    status: "ok",
    options: LogisterEventOptions(
        durationMs: 812.4,
        context: ["expected_interval_seconds": .number(86_400)]
    )
)

Use shared trace IDs when a screen action triggers multiple spans. Check-ins are useful for recurring sync, cleanup, cache refresh, background fetch, or other scheduled app work where a missed run should be visible.

Mobile context

Send safe iOS metadata that helps debugging without collecting secrets.

FieldRecommended valueWhy it helps
platformiosSeparates iOS telemetry from server and Android data.
serviceBundle IDIdentifies the app sending events.
releaseApp version plus build numberSupports release filters and regression review.
environmentproduction, staging, or release channelFilters telemetry by deployment channel.
repositoryGitHub owner/repo, such as acme/ios-appLets source lookup find the connected repository.
commit_shaThe app build commitResolves stack frames and deployment context to exact source.
branchRelease branch or GitHub ref nameFallback when a commit or deployment record is missing.
session_idApp-generated session identifierConnects related mobile events without sending raw user data.
screen_nameStable screen or route nameMakes activity, transactions, and spans easier to scan.
ios_versionMajor/minor OS versionHelps spot OS-version-specific failures.
device_modelSanitized device family/modelHelps debug device-specific issues.

Privacy defaults

Keep iOS instrumentation explicit.

The iOS add-on starts with manual capture methods. Automatic crash breadcrumbs, screen timing, URLSession timing, retry, and offline-queue instrumentation should stay opt-in so each app can decide what data is collected, retained, and sent over the network.

  • Do not send API tokens, authorization headers, cookies, payment data, medical data, or raw request/response bodies.
  • Prefer stable, low-cardinality values such as screen names, feature names, build metadata, status codes, and safe session IDs.
  • Use the app's privacy review before sending device identifiers, user identifiers, query text, or raw URLs.

Verification

Confirm one event from the app before widening instrumentation.

Checklist
Swift Package Manager resolves the Logister product
client can send one captureMessage call
Activity page shows the iOS log event
Inbox shows a test exception when captureException is called
Insights can filter by environment, release, service, or screen_name
Performance shows transactions or spans after timing events arrive
Event detail shows source context when repository and commitSHA are configured
Event detail shows deployment context after CI posts /api/v1/deployments

Package releases

iOS SDK releases are versioned separately from the Rails app.

Swift Package Manager distribution resolves from the public Git repository and semantic version tags. The iOS release workflow verifies the package and creates the matching GitHub Release, so app teams can update through Xcode or SwiftPM when a new tag is available.