Analytics > Scout
Production-grade logging SDK for iOS apps using CloudKit as a backend.
Description
Scout is an iOS logging and analytics framework backed by CloudKit. It collects structured logs, metrics, and crash reports from your app and syncs them to a public CloudKit database where you can inspect them through a built-in SwiftUI dashboard.
Table of Contents
Features
| 📝 | Structured Logging | Integrates with swift-log. All log levels, labels, and metadata are persisted and synced automatically. |
| 📊 | Metrics | Integrates with swift-metrics. Counters, timers, and floating-point counters are recorded alongside logs. |
| 💥 | Crash Reporting | Captures uncaught exceptions and signals (SIGABRT, SIGSEGV, etc.) with stack traces. Reports are flushed on the next launch. |
| ☁️ | CloudKit Sync | All data is stored locally with Core Data and synced to a public CloudKit database. No custom backend required. |
| 📱 | SwiftUI Dashboard | A built-in HomeView with charts, event lists, crash details, and activity tracking for debugging in development builds. |
Installation
Add the dependency to your Package.swift:
.package(url: "https://github.com/kasianov-mikhail/scout.git", from: "3.0.0")
For CloudKit setup and schema upload, see the full Installation Guide.
Usage
Call setup once during app launch. This bootstraps logging, metrics, and crash reporting:
import CloudKit
import Scout
let container = CKContainer(identifier: "YOUR_CONTAINER_ID")
try await setup(container: container)
After setup, use the standard swift-log API to write logs:
import Logging
let logger = Logger(label: "MyApp")
logger.warning(
"Search_Performed",
metadata: [
"description": .string(error.localizedDescription),
"ip": .string(ip),
]
)
Metrics work the same way via swift-metrics:
import Metrics
Counter(label: "api_requests").increment()
Timer(label: "response_time").recordSeconds(duration)
Dashboard
Present HomeView to browse logs, metrics, crashes, and user activity:
HomeView(container: container)
Use this only in debug builds to avoid exposing log data in production.
Example Project
See the Scout IP repository for a complete example app using Scout with CloudKit.
License
Scout is released under the MIT License. See LICENSE for details.