diff --git a/docs/platforms/apple/common/configuration/swizzling.mdx b/docs/platforms/apple/common/configuration/swizzling.mdx index 45d3b298d399e..c861d513d4b05 100644 --- a/docs/platforms/apple/common/configuration/swizzling.mdx +++ b/docs/platforms/apple/common/configuration/swizzling.mdx @@ -47,3 +47,30 @@ SentrySDK.start { options in options.enableSwizzling = NO; }]; ``` + + +## Skip Swizzling for Specific Classes + +To skip swizzling specific classes, you can use the option `swizzleClassNameExcludes`, which is available with Sentry Cocoa SDK version `8.23.0` and above. The SDK checks if the class name of a class to swizzle contains a class name of this option. For example, if you add MyUIViewController to this list, the Sentry Cocoa SDK excludes the following classes from swizzling: + +- YourApp.MyUIViewController, +- YourApp.MyUIViewControllerA +- MyApp.MyUIViewController + + +```swift +SentrySDK.start { options in + options.swizzleClassNameExcludes = [ + "MyUIViewController", + ] +} +``` + +```objc {tabTitle:Objective-C} +[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.swizzleClassNameExcludes = [NSSet setWithObjects: + @"MyUIViewController", + nil + ]; +}]; +``` diff --git a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx index 3623fec2082b6..6de313e5f8003 100644 --- a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx +++ b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx @@ -58,8 +58,29 @@ SentrySDK.start { options in }]; ``` +You can disable UIViewController tracing for specific UIViewControllers by using the option `swizzleClassNameExcludes`: + + +```swift +SentrySDK.start { options in + options.swizzleClassNameExcludes = [ + "MyUIViewController", + ] +} +``` + +```objc {tabTitle:Objective-C} +[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.swizzleClassNameExcludes = [NSSet setWithObjects: + @"MyUIViewController", + nil + ]; +}]; +``` + [UIViewController]: https://developer.apple.com/documentation/uikit/uiviewcontroller + ## App Start Tracing This feature is available for iOS, tvOS, and Mac Catalyst.