App performance monitoring provides insight into how an iOS app is experienced on screen. This includes how long the app takes to become ready, which screens are shown, and how users move between them.
OneAgent for iOS tracks this flow from the initial App Start up to in-app navigations between views, until the app is backgrounded or terminated.
OneAgent for iOS captures the following concepts and stores them as events in Grail:
These concepts follow the general mobile RUM model described in Mobile RUM Concepts. For definitions, see Application start, Views and view summaries, and Navigations.
Each event consists of well-defined key-value fields as specified in the Semantic Dictionary for user events, including app_start.*, navigation.*, and view.*.
This data can be analyzed in apps such as Experience Vitals and Users & Sessions, or queried directly in Grail using DQL.
OneAgent for iOS captures startup and lifecycle information automatically by registering for iOS lifecycle callbacks (via NotificationCenter and UIKit method swizzling). Based on this information, OneAgent can automatically detect views for UIViewController subclasses.
For SwiftUI applications, the Dynatrace SwiftUI Instrumentor provides build-time instrumentation that automatically captures views when using NavigationLink, navigationDestination, sheet, popover, and other navigation patterns. For custom scenarios not covered by automatic instrumentation, views can be captured manually using Dynatrace.startView(...).
The App Start event measures how long it takes for an app to become ready after a startup or foreground transition.
OneAgent classifies app starts into three types: cold, warm, and hot (see Application start for definitions and examples).
On iOS, classification is derived from process and UIApplication lifecycle signals (for example, whether the process was freshly created and whether the device was recently rebooted).
In addition to being available as an app start event, an app start is also represented as a navigation event (a navigation without a source view).
OneAgent tracks app start based on iOS lifecycle callbacks, capturing a sequence of phases:
UIApplication initialization.UIApplication init to application(_:didFinishLaunchingWithOptions:).didFinishLaunching to UIViewController.loadView.loadView to applicationDidBecomeActive.OneAgent for iOS distinguishes between three app start types:
| Type | Description |
|---|---|
| Cold | Occurs when the device was rebooted after the last launch, or the app is launched for the first time. The process and all app resources must be fully initialized. |
| Warm | Occurs when the app was previously terminated but the device was not rebooted. Some system caches may still be available. |
| Hot | Occurs when the app was already running in the background and is brought to the foreground. The process is resumed rather than created. |
To capture the full app start duration, measurement must begin as early as possible. For auto-instrumented applications, OneAgent starts measuring by swizzling UIApplication and UIViewController lifecycle methods. If automatic startup is disabled or the agent is started manually, measurement begins only when the agent starts. In this case, calling Dynatrace.startup(...) as early as possible (ideally in application(_:didFinishLaunchingWithOptions:)) ensures accurate results. Otherwise, the reported duration may be shorter than the actual startup time.
A navigation event represents a transition context between views, or a change in the app's visible state (see Navigations).
A navigation can have:
In the common case, a navigation acts as a glue event between two views.
Navigations are generated for both automatic view tracking (UIViewController transitions) and manual view tracking (via Dynatrace.startView(...)).
In Dynatrace, a view represents a user-visible screen (see Views and view summaries).
For the field reference, see View attributes.
OneAgent tracks views automatically for UIViewController subclasses. For SwiftUI applications, the Dynatrace SwiftUI Instrumentor enables automatic view tracking for navigation-related components. For other UI components, views can be tracked manually.
Only one view can be active at a time. Starting a new view automatically closes the previous one and triggers a navigation event.
While the app is in the foreground, OneAgent for iOS maintains a current view context. The view name is attached to events captured automatically (for example, web requests) and to events created via the Dynatrace APIs. This provides the screen context in which an event occurred.
For UIViewController subclasses, OneAgent captures views based on lifecycle callbacks:
UIViewController enters viewDidAppear.UIViewController enters viewDidDisappear.OneAgent automatically detects view controllers within container controllers:
UINavigationController—tracks push and pop operations.UITabBarController—tracks tab selections.UISplitViewController—tracks detail view controller changes.present(_:animated:completion:) and dismiss(animated:completion:).For SwiftUI applications, the Dynatrace SwiftUI Instrumentor provides build-time instrumentation that automatically captures views.
The SwiftUI Instrumentor automatically tracks views for the following navigation patterns:
| Component | Description |
|---|---|
NavigationLink | Tracks the destination view when navigating via NavigationLink |
navigationDestination | Tracks views presented via the navigationDestination(for:destination:) modifier |
sheet | Tracks views presented as modal sheets |
popover | Tracks views presented as popovers |
TabView | Tracks tab selections and their associated views |
Menu | Tracks the menu container lifecycle |
For more information on setting up the SwiftUI Instrumentor, see SwiftUI Instrumentation.
For UI components that are not auto-detected (such as custom container controllers, embedded content, or SwiftUI views not using the supported navigation patterns), use Dynatrace.startView(...):
Dynatrace.startView(name: "Login")
Calling startView starts a new view and automatically ends the previously active view. All events captured thereafter are evaluated in the context of that view.
To disable automatic view tracking and rely solely on manual view instrumentation, set the DTXInstrumentLifecycleMonitoring configuration key to false in your app's Info.plist file:
<key>DTXInstrumentLifecycleMonitoring</key><false/>
When automatic view tracking is disabled:
Dynatrace.startView(...).When a view ends, OneAgent creates a view summary, an aggregated event summarizing what happened during the view's lifetime (see Views and view summaries). View summaries are reported separately from other events.
For the field reference, see View summary.
While a view is active, OneAgent tracks all events that occur within that view context. When you call Dynatrace.sendHttpRequestEvent(...) or when errors are reported, these are automatically associated with the current view.
When the view ends (either by starting a new view or the app going to background), the view summary is generated and sent to Dynatrace.