iOS
Integrate the native Ansight iOS SDK with SwiftUI or UIKit apps, including pairing, telemetry, screenshots, touch input, lifecycle capture, and native remote tools.
The native iOS SDK brings the same Ansight runtime concepts to Swift, UIKit, and SwiftUI apps.
Use the aggregate Ansight product for local development builds that need developer defaults, platform pairing UI, and the standard native tool suites. Use AnsightCore plus selected products when you want a smaller surface.
Package Products
| Product | Registry | Purpose |
|---|---|---|
Ansight | CocoaPods | Aggregate setup with AnsightCore, QR/file pairing, database, file-system, preferences, reflection, secure-storage, and visual-tree tools. |
AnsightCore | CocoaPods | Runtime lifecycle, telemetry, host connection, pairing protocol, screenshots, touch input, tool abstractions, and build-time checks. |
AnsightPairingQR | CocoaPods | UIKit document import and AVFoundation QR scanning for SDK-owned pairing UI. |
AnsightToolsVisualTree | CocoaPods | UIKit visual tree, screenshot, node inspection, and overlay tools. |
AnsightToolsFileSystem | CocoaPods | Sandboxed file list, read, checksum, download, push, copy, move, and delete tools. |
AnsightToolsDatabase | CocoaPods | SQLite discovery, schema inspection, and constrained read-only query tools. |
AnsightToolsPreferences | CocoaPods | UserDefaults list, read, write, and remove tools. |
AnsightToolsSecureStorage | CocoaPods | Allow-listed Keychain read, write, and remove tools. |
AnsightToolsReflection | CocoaPods | Registered-root runtime inspection plus opt-in write/invoke hooks. |
AnsightObjC | CocoaPods | Objective-C facade used by the React Native bridge. |
Quickstart
Put runtime initialization in AppDelegate.application(_:didFinishLaunchingWithOptions:).
For SwiftUI lifecycle apps, attach an UIApplicationDelegate with
@UIApplicationDelegateAdaptor. Use SceneDelegate only for scene-specific UI
or pairing presentation, not for one-time runtime initialization.
import Ansight
try AnsightRuntime.shared.initializeAndActivateAnsightSdk()
await AnsightRuntime.shared.connect(.auto(clientName: "iOS App"))
initializeAndActivateAnsightSdk() applies the native developer preset:
- sample frequency
400ms - retention
120s - FPS enabled
- battery disabled
- UIKit lifecycle and screen-view capture enabled
- JPEG capture every
2000msat quality60, max width480, and GPU-backed surface capture enabled - touch capture enabled
- host auto-probe enabled
- full tool access
- standard native tool suites registered
Important: Screen capture will result in an FPS drop while the SDK renders, encodes, and transports frames. Disable session JPEG capture for performance-focused runs unless visual evidence is required.
Core-Only Setup
import AnsightCore
let options = try AnsightOptions.createBuilder()
.withFramesPerSecond()
.withReadOnlyToolAccess()
.build()
try AnsightRuntime.shared.initializeAndActivate(options: options)
Core-only setup gives you the runtime, telemetry, pairing, screenshots, touch input, and custom tool abstractions without registering concrete tool suites.
Common Next Steps
- Use Setup Packages to choose SwiftPM products or CocoaPods pods.
- Use iOS Security before enabling aggregate setup or native tool products.
- Use Pairing to connect to Ansight Studio through developer pairing, QR, or payload flows.
- Use Configuration to tune sampling, capture, pairing, and tool guard policy.
- Use Performance Telemetry to capture FPS, memory, custom metrics, and battery telemetry.
- Use JPEG Screenshots for periodic session capture and on-demand screenshots.
- Use Touch Input to capture taps, drags, and cancellations.
- Use Screen Views to record UIKit, SwiftUI, or custom route changes.
- Use Capturing Logs for app events, custom client logs, and SDK diagnostics.
- Use App Lifecycle to track foreground and background state.
- Use Artifacts to register and serve app-owned diagnostic exports.
- Use Tools to register and guard native tool suites.