Skip to content

Commit 891c6de

Browse files
krystofwoldrichantonpirker
authored andcommitted
Fix iOS SR Custom Redact whitespace prefix in code snippets (#13806)
1 parent a6377ba commit 891c6de

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

docs/platforms/apple/guides/ios/session-replay/customredact.mdx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ You can choose which type of view you want to mask or unmask by using the `maske
2121
Let's say you have a custom view that you want to mask and a `UILabel` subclass (which normally would be masked) that you don't want to mask. You can set the options like this:
2222

2323
```swift
24-
options.sessionReplay.maskedViewClasses = [MyCustomView.self]
25-
options.sessionReplay.unmaskedViewClasses = [MyCustomLabel.self]
24+
options.sessionReplay.maskedViewClasses = [MyCustomView.self]
25+
options.sessionReplay.unmaskedViewClasses = [MyCustomLabel.self]
2626
```
2727

2828
## Mask by View Instance
2929

3030
You can also choose to mask or unmask a specific view instance by using the replay API (`SentrySDK.replay`) or view extensions like this:
3131

3232
```swift
33-
SentrySDK.replay.maskView(view: view)
34-
SentrySDK.replay.unmaskView(view: label)
33+
SentrySDK.replay.maskView(view: view)
34+
SentrySDK.replay.unmaskView(view: label)
3535
```
3636

3737
or
3838

3939
```swift
40-
view.sentryReplayMask()
41-
label.sentryReplayUnmask()
40+
view.sentryReplayMask()
41+
label.sentryReplayUnmask()
4242
```
4343

4444
## SwiftUI
@@ -49,46 +49,46 @@ In order to control the SwiftUI masking process, you need to use the `sentryRepl
4949
In this example we want to show the message, but not the user name.
5050

5151
```swift
52-
@Binding var user: String
53-
54-
var body: some View {
55-
VStack {
56-
Text("Hello")
57-
.sentryReplayUnmask()
58-
Text("\(user)")
59-
}
52+
@Binding var user: String
53+
54+
var body: some View {
55+
VStack {
56+
Text("Hello")
57+
.sentryReplayUnmask()
58+
Text("\(user)")
6059
}
60+
}
6161
```
6262

6363
In this example, we need to unmask the VStack because its background element will be masked by default.
6464
To hide the username, we need to mask it.
6565

6666
```swift
67-
@Binding var user: String
68-
69-
var body: some View {
70-
VStack {
71-
Text("Hello")
72-
Text("\(user)")
73-
.sentryReplayMask()
74-
}
75-
.background(.blue)
76-
.sentryReplayUnmask()
67+
@Binding var user: String
68+
69+
var body: some View {
70+
VStack {
71+
Text("Hello")
72+
Text("\(user)")
73+
.sentryReplayMask()
7774
}
75+
.background(.blue)
76+
.sentryReplayUnmask()
77+
}
7878
```
7979

8080
## Debugging Session Replay masking
8181

8282
To see how elements are being masked, enable the masking preview from anywhere in your app. It will display an overlay on top of the masked elements. This works on the simulator and on device, as well as within Xcode Preview.
8383

8484
```swift
85-
SentrySDK.replay.showMaskPreview()
85+
SentrySDK.replay.showMaskPreview()
8686
```
8787

8888
By default, the overlay will be opaque. To configure the opacity, pass the desired opacity as a parameter:
8989

9090
```swift
91-
SentrySDK.replay.showMaskPreview(0.5) // 0.5 opacity to render the preview semi-transparent
91+
SentrySDK.replay.showMaskPreview(0.5) // 0.5 opacity to render the preview semi-transparent
9292
```
9393

9494
Make sure not accidentally include this in your release build by e.g. wrapping it in a `#if DEBUG` block.

0 commit comments

Comments
 (0)