iOS
Add the native Ansight iOS SDK to a SwiftUI or UIKit development build and initialize it from app startup.
The native iOS SDK brings the same Ansight runtime concepts to Swift, UIKit, and SwiftUI apps.
Quickstart
Add the Swift package and its aggregate Ansight product to the app’s
development target:
.package(url: "https://github.com/ansight-ai/ansight-sdk.git", exact: "1.4.0-preview.1")
.product(name: "Ansight", package: "ansight-sdk")
CocoaPods users can add pod 'Ansight', '1.4.0-preview.1' instead. See
iOS Packages for every product and package-manager
option.
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.
#if DEBUG
import Ansight
try AnsightRuntime.shared.initializeAndActivateAnsightSdk()
#endif
The iOS Simulator and Mac Catalyst register automatically with the local CLI
host through loopback. Do not start a second explicit .auto(...) connection
after initialization. A physical iPhone or iPad scans one generic CLI host QR;
see Enrollment.
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 trend-focused runs unless visual evidence is required.
Common Next Steps
- Use iOS Setup for the full guarded startup and CLI verification flow.
- Use iOS Packages to choose the aggregate, core, pairing, Objective-C, or individual tool products.
- Use iOS Security before enabling aggregate setup or native tool products.
- Use Enrollment to scan once and reconnect automatically.
- Use Configuration to tune sampling, capture, pairing, and tool guard policy.
- Use Trends Telemetry to capture FPS, memory, custom metrics, and battery telemetry.
- Use JPEG Screenshots for periodic session capture and on-demand screenshots.
- Use Crash Capture to configure next-launch crash recovery, retention, and handoff.
- 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 Objective-C when an Objective-C host or bridge layer needs the aggregate SDK through an
NSObjectfacade. - Use Tools to register and guard native tool suites.