SDK Configuration
Auto capture is off by default. Auto capture behavior is configured throughUserpilot.Config during SDK initialization.
Example: disable all text and accessibility label capture for maximum privacy:
UIKit Capture
UIKit screen capture is handled by view controller lifecycle callbacks.Screen Tracking
By default, only direct children ofUINavigationController, UITabBarController, UISplitViewController, and UIPageViewController are treated as screens. Override isUserpilotContainerClass when a custom container’s children should be treated as screens:
userpilotScreenName to use a stable, meaningful name instead of the view controller class name:
userpilotScreenTitle to supply a custom title or disable title capture for that screen:
userpilotIgnoreScreen when a view controller is auxiliary content that should not emit its own automatic screen-view event:
Screen Events
When screen auto capture is enabled, the SDK publishes a screen event the first time aUIViewController appears (pushed, presented, or shown in a tab). Each screen event carries the current screen’s metadata only — there is no previous screen, path, timestamp, or root-flag field on the event itself.
UIAlertController is not tracked as a screen. Its presentation is routed to the dialog auto capture path and emitted as a mobile_autocapture interaction with interaction_type = "view_presented" carrying the alert’s title and message.
Interaction Events
When interaction auto capture is enabled, the SDK captures:UIKit Privacy Helpers
UseUserpilot.Config to disable text, accessibility label, or screen title capture globally. Because accessibility labels can mirror on-screen text when accessibility features are on, disable enableInteractionAccessibilityLabelCapture when using enableInteractionTextCapture(false).
Use these helpers for UIKit-specific privacy and payload control:
userpilotRedactText— replace captured text with****userpilotRedactAccessibilityLabel— replace captured accessibility labels with****userpilotIgnoreInteractions— skip interaction capture for a responder subtreeuserpilotIgnoreInnerHierarchy— attribute child taps to the container and hide inner details while still recording that an interaction happened
userpilotIgnoreInteractions (which records nothing), userpilotIgnoreInnerHierarchy still sends a tap event — it just omits inner details.
Class-level defaults are available via overridable class properties:
Custom Clickable Views
Standard controls (UIButton, UIControl subclasses, table/collection cells) and tappable views in the normal touch chain are captured automatically. For custom UIKit views that act as buttons but are not recognized, call:
UIButton, other UIControl subclasses, or views that already receive touches in the responder chain.
For SwiftUI, the equivalent API is userpilotLabel(_:) — it tags any SwiftUI view (including composite ones using .onTapGesture) with a stable analytics label and view type. See Labeling Custom SwiftUI Views below.
SwiftUI Capture
SwiftUI interaction capture is emitted through the hosting controller and routed through the same auto capture pipeline as UIKit capture. SwiftUI exposes a small set of view modifiers that mirror the UIKit auto capture surface.
All UIKit configuration options — including
enableInteractionTextCapture, enableInteractionAccessibilityLabelCapture, enableInteractionValueCapture, and enableScreenTitleCapture — apply unchanged to SwiftUI apps.
Captured SwiftUI interactions include:
- TextField and TextEditor text changes.
- Toggle, slider, stepper, and picker value changes
- List row and inline/wheel picker selections
- Most views with
.onTapGesture— observed through the sameUIWindowswizzle the SDK uses for UIKit
SwiftUI Screen Tracking
WithenableScreenAutoCapture(true), the SDK records a screen event whenever a SwiftUI view becomes visible inside its UIHostingController. By default the screen name is derived from the SwiftUI type.
Use userpilotScreenName(_:) to override the auto captured screen name with a stable, human-readable string. The modifier propagates the name to the underlying hosting controller, so it takes effect on the next automatic screen event for that screen. This is the right choice when screen auto capture is enabled and you want a better label than the synthesized SwiftUI type name.
Use userpilotScreen(_:) when screen auto capture is disabled (or when you need to emit an additional screen event for a non-routing view such as a tab). It calls Userpilot.screen(_:) from .onAppear. If name is omitted the SwiftUI type name is used.
Labeling Custom SwiftUI Views
The recommended way to make a custom or composite SwiftUI view identifiable in analytics isuserpilotLabel(_:). The modifier sets a stable label and a logical view type (Button, Text, Toggle, NavigationLink, or the SwiftUI type name) on the resolved underlying UIKit view. The auto capture pipeline reads those values and reports them as element_text on every interaction event the view emits.
SwiftUI Privacy Helpers
UseuserpilotRedactText(_:) to mark text content under a view as sensitive. Captured element_text becomes ****; the on-screen text is unchanged. The flag propagates down the responder chain, so applying it to a container redacts every descendant.
enableInteractionAccessibilityLabelCapture config to disable accessibility-label capture process-wide, or attach userpilotRedactAccessibilityLabel = true to the underlying UIKit view via a UIViewRepresentable if you need per-view control.
Use userpilotIgnoreInteractions(_:) to stop the SDK from emitting any interaction events for a view and its descendants. The view itself stays fully functional.