Configuration

Configure native iOS sampling, memory channels, screenshots, touch input, pairing, lifecycle capture, custom properties, and tool guard policy.

Configure iOS with AnsightOptions or AnsightOptions.createBuilder().

import Ansight

try AnsightRuntime.shared.initializeAndActivateAnsightSdk { options in
    options
        .withReadOnlyToolAccess()
        .withBatteryLevel()
}

The aggregate setup applies FPS sampling, 400ms sampling, 120s retention, JPEG capture at 2000ms / quality 60 / max width 480 with GPU-backed surface capture enabled, touch capture, UIKit lifecycle capture, host auto-probe, bundled developer pairing, full tool access, and standard native tool registration.

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 Options

import AnsightCore

let options = try AnsightOptions.createBuilder()
    .withSampleFrequencyMilliseconds(500)
    .withRetentionPeriodSeconds(600)
    .withFramesPerSecond()
    .withBatteryLevel()
    .withSessionJpegCapture(
        intervalMilliseconds: 2000,
        quality: 60,
        maxWidth: 480,
        captureGpuBackedSurfaces: true
    )
    .withReadOnlyToolAccess()
    .build()

try AnsightRuntime.shared.initializeAndActivate(options: options)

Defaults

AnsightOptions() starts with conservative core defaults:

  • sample frequency 500ms
  • retention 600s
  • FPS enabled
  • battery disabled
  • platform default memory channels
  • no session JPEG capture unless configured
  • touch capture enabled by default in native options
  • tool guard disabled
  • host auto-probe enabled

AnsightOptions.ansightDeveloperDefaults uses the aggregate local-development defaults.

Option Surface

OptionPurpose
sampleFrequencyMillisecondsBuilt-in telemetry sampling interval. Clamped to 200-2000ms.
retentionPeriodSecondsLocal metric/event retention window. Clamped to 60-3600s.
additionalChannelsCustom metric channels. Reserved ids are rejected.
defaultMemoryChannelsBuilt-in memory channels such as managed heap and physical footprint.
enableFramesPerSecondEnables CADisplayLink FPS sampling.
enableBatteryLevelEnables UIDevice battery sampling.
lifecycleCaptureControls automatic UIKit lifecycle and screen-view capture.
sessionJpegCaptureConfigures live JPEG screen-frame streaming. nil disables it. captureGpuBackedSurfaces defaults to true for Metal, SceneKit, and similar GPU-backed views.
touchCaptureConfigures app-local touch capture. nil disables it.
toolGuardControls remote-tool discovery and execution.
customPropertiesGrouped string properties sent with session.open.
hostAutoProbeControls automatic reconnect attempts.
hostConnectionConfigures saved, cached, bundled, and developer pairing sources.

Tool Guard

PresetAllowed scopes
.disabledNone
.readOnly.read
.readWrite.read, .write
.fullAccess.read, .write, .delete

Delete-scoped tools such as file delete, preference removal, secure-storage removal, and overlay removal require .fullAccess.

Host Auto-Probe

let options = try AnsightOptions.createBuilder()
    .withHostAutoProbe(
        AnsightHostAutoProbeOptions(
            enabled: true,
            initialDelayMilliseconds: 1_000,
            probeIntervalMilliseconds: 5_000,
            reconnectDelayMilliseconds: 10_000,
            clientName: "iOS App"
        )
    )
    .build()
PropertyDefault
enabledtrue
initialDelayMilliseconds1000
probeIntervalMilliseconds5000
reconnectDelayMilliseconds10000
clientNamenil

Disable it when you want explicit pairing only:

let options = try AnsightOptions.createBuilder()
    .withoutHostAutoProbe()
    .build()