@@ -84,6 +84,19 @@ extension RUM {
84
84
/// Default: `nil` - which means automatic RUM action tracking is not enabled by default.
85
85
public var uiKitActionsPredicate : UIKitRUMActionsPredicate ?
86
86
87
+ /// The predicate for automatically tracking `UIViewControllers` as RUM views.
88
+ ///
89
+ /// RUM will query this predicate for each `UIViewController` presented in the app. The predicate implementation
90
+ /// should return RUM view parameters if the given controller should start a view, or `nil` to ignore it.
91
+ ///
92
+ /// You can use `DefaultSwiftUIRUMViewsPredicate` or create your own predicate by implementing `SwiftUIRUMViewsPredicate`.
93
+ ///
94
+ /// Note: Automatic RUM views tracking involves swizzling the `UIViewController` lifecycle methods.
95
+ ///
96
+ /// Default: `nil` - which means automatic RUM view tracking is not enabled by default.
97
+ @available ( * , message: " This API is experimental and may change in future releases " )
98
+ public var swiftUIViewsPredicate : SwiftUIRUMViewsPredicate ?
99
+
87
100
/// The configuration for automatic RUM resources tracking.
88
101
///
89
102
/// RUM resources tracking requires enabling `URLSessionInstrumentation`. See
@@ -179,7 +192,7 @@ extension RUM {
179
192
/// and do not make any assumptions on the thread used to run it.
180
193
///
181
194
/// Note: This mapper ensures that all views are sent by preventing the return of `nil`. To drop certain automatically
182
- /// collected RUM views, adjust the implementation of the view predicate (see the `uiKitViewsPredicate` option ).
195
+ /// collected RUM views, adjust the implementation of the view predicate (see the `uiKitViewsPredicate` and `swiftUIPredicate` options ).
183
196
///
184
197
/// Default: `nil`.
185
198
public var viewEventMapper : RUM . ViewEventMapper ?
@@ -377,8 +390,9 @@ extension RUM.Configuration {
377
390
/// - Parameters:
378
391
/// - applicationID: The RUM application identifier.
379
392
/// - sessionSampleRate: The sampling rate for RUM sessions. Must be a value between `0` and `100`. Default: `100`.
380
- /// - uiKitViewsPredicate: The predicate for automatically tracking `UIViewControllers` as RUM views. Default: `nil`.
393
+ /// - uiKitViewsPredicate: The predicate for automatically tracking `UIViewControllers` in `UIKit` as RUM views. Default: `nil`.
381
394
/// - uiKitActionsPredicate: The predicate for automatically tracking `UITouch` events as RUM actions. Default: `nil`.
395
+ /// - swiftUIViewsPredicate: The predicate for automatically tracking `UIViewControllers` in `SwiftUI` as RUM views. Default: `nil`.
382
396
/// - urlSessionTracking: The configuration for automatic RUM resources tracking. Default: `nil`.
383
397
/// - trackFrustrations: Determines whether automatic tracking of user frustrations should be enabled. Default: `true`.
384
398
/// - trackBackgroundEvents: Determines whether RUM events should be tracked when no view is active. Default: `false`.
@@ -404,6 +418,7 @@ extension RUM.Configuration {
404
418
sessionSampleRate: SampleRate = . maxSampleRate,
405
419
uiKitViewsPredicate: UIKitRUMViewsPredicate ? = nil ,
406
420
uiKitActionsPredicate: UIKitRUMActionsPredicate ? = nil ,
421
+ swiftUIViewsPredicate: SwiftUIRUMViewsPredicate ? = nil ,
407
422
urlSessionTracking: URLSessionTracking ? = nil ,
408
423
trackFrustrations: Bool = true ,
409
424
trackBackgroundEvents: Bool = false ,
@@ -428,6 +443,7 @@ extension RUM.Configuration {
428
443
self . sessionSampleRate = sessionSampleRate
429
444
self . uiKitViewsPredicate = uiKitViewsPredicate
430
445
self . uiKitActionsPredicate = uiKitActionsPredicate
446
+ self . swiftUIViewsPredicate = swiftUIViewsPredicate
431
447
self . urlSessionTracking = urlSessionTracking
432
448
self . trackFrustrations = trackFrustrations
433
449
self . trackBackgroundEvents = trackBackgroundEvents
0 commit comments