iOS SDK (Native Swift)
The Mobore iOS SDK is a native Swift library for Real User Monitoring on Apple platforms. It provides zero-configuration auto-instrumentation for crashes, network requests, screen transitions, taps, hangs, and more — all exported as OpenTelemetry signals over OTLP/HTTP.
For the complete and most up-to-date reference, see the full documentation on GitHub.
Platform support
Section titled “Platform support”| Platform | Minimum Version |
|---|---|
| iOS | 16.0 |
| macOS | 13.0 |
| tvOS | 16.0 |
| watchOS | 10.0 |
Installation
Section titled “Installation”Swift Package Manager
Section titled “Swift Package Manager”In Xcode:
- Navigate to File > Add Package Dependencies…
- Enter
https://github.com/mobore/mobore-ios-sdk.git - Select Up to Next Major Version starting from
0.9.4 - Add
MoboreIosSdkto your app target
Or add it directly in Package.swift:
dependencies: [ .package(url: "https://github.com/mobore/mobore-ios-sdk.git", .upToNextMajor(from: "0.9.4"))]CocoaPods
Section titled “CocoaPods”pod 'MoboreIosSdk', '~> 0.9.0'pod installQuick start
Section titled “Quick start”Start the SDK as early as possible in your app lifecycle. A single call enables all auto-instrumentation with sensible defaults.
UIKit
import MoboreIosSdk
@mainclass AppDelegate: UIResponder, UIApplicationDelegate { func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { MoboreIosSdkAgent.start() return true }}SwiftUI
import SwiftUIimport MoboreIosSdk
@mainstruct MyApp: App { init() { MoboreIosSdkAgent.start() }
var body: some Scene { WindowGroup { ContentView() } }}Configuration
Section titled “Configuration”Pass a custom configuration to control the collector endpoint, environment, and sampling:
let config = MoboreAgentConfigBuilder() .withClientToken("YOUR_CLIENT_TOKEN") .withEnvironment("production") .withSessionSampleRate(1.0) .build()
MoboreIosSdkAgent.start(with: config)| Option | Default | Description |
|---|---|---|
clientToken | nil | Authorization header for OTLP exports |
environment | "development" | Deployment environment name |
exportUrl | https://traces.mobore.com | Collector endpoint |
sessionSampleRate | 1.0 | Session-level sampling (0.0 to 1.0) |
What is auto-instrumented
Section titled “What is auto-instrumented”All of the following are captured out of the box with default settings:
- Crashes — native signal and Mach exception handling via PLCrashReporter
- App hangs — main thread blocked > 2 seconds
- Network requests — all URLSession traffic with status codes and timings
- Screen transitions — UIViewController lifecycle and SwiftUI hosting controllers
- Tap events — target, action, element metadata, and coordinates
- App lifecycle — active, inactive, background, foreground, terminate
- Push notifications — foreground delivery and user taps
- WebView navigation — WKWebView request, start, finish, and error events
- System metrics — CPU and memory usage gauges
- MetricKit — launch times, hang times, and exit statistics
- Low power mode — state change detection
- Session usage — active screen time tracking with inactivity detection
Each module can be individually toggled. See the instrumentation configuration reference for all options.
Manual instrumentation
Section titled “Manual instrumentation”The SDK exposes static methods on MoboreIosSdkAgent for custom telemetry:
// Track a view manually (useful for SwiftUI)MoboreIosSdkAgent.startView(name: "Checkout")MoboreIosSdkAgent.endCurrentView()
// Record a custom actionMoboreIosSdkAgent.addAction(name: "add_to_cart", attributes: ["product_id": "SKU-123"])
// Report an errorMoboreIosSdkAgent.addError(message: "Payment failed", source: "PaymentService")
// Emit a logMoboreIosSdkAgent.addLog(message: "Order placed", level: "info", attributes: ["order_id": "456"])
// Set user contextMoboreIosSdkAgent.setUser(["id": "user-789", "plan": "enterprise"])
// Add global attributes to all signalsMoboreIosSdkAgent.addGlobalAttribute(key: "feature_flag", value: "new_checkout")SwiftUI view names
Section titled “SwiftUI view names”Use the .reportName() modifier to set meaningful screen names for SwiftUI views:
struct ProductDetailView: View { var body: some View { ScrollView { /* ... */ } .reportName("ProductDetail") }}Further reading
Section titled “Further reading”The full documentation covers advanced topics including signal filtering, attribute interceptors, session management, data persistence, privacy manifests, and troubleshooting: