Skip to content

Commit

Permalink
feat(apple): Add docs for swizzleClassNameExcludes
Browse files Browse the repository at this point in the history
Add docs for the existing option swizzleClassNameExcludes.
  • Loading branch information
philipphofmann committed Aug 6, 2024
1 parent 64ae970 commit 11a095f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/platforms/apple/common/configuration/swizzling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
];
}];
```
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,29 @@ SentrySDK.start { options in
}];
```
You can disable UIViewController tracing for specific UIViewControllers by using the option <PlatformLink to="/configuration/swizzling#skip-swizzling-for-specific-classes">`swizzleClassNameExcludes`</PlatformLink>:
```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.
Expand Down

0 comments on commit 11a095f

Please sign in to comment.