TraceItX.shared.markSensitive(cardNumberLabel)
Register the view once, on the main thread — in viewDidLoad, or wherever you
build it. The SDK sets an associated tx_isSensitive marker on the view itself
rather than keeping a registry, so marking does not retain the view and there is
nothing to un-mark on teardown.
For views you build yourself, two equivalents: set view.tx_isSensitive = true
directly, or make the container a TXSensitiveView. A sensitive view masks its
whole subtree.
The masking happens in the producer, before capture — masked content never enters the screenshot buffer or the replay stream, let alone the upload. It is not a flag a viewer is trusted to honour.
SwiftUI
Reach the underlying view through a representable, or mark the hosting controller’s view when a whole screen is sensitive:
struct SensitiveMarker: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
let v = UIView()
TraceItX.shared.markSensitive(v)
return v
}
func updateUIView(_ uiView: UIView, context: Context) {}
}
Masking follows the view’s frame across layout changes rather than pinning a rectangle that goes stale when the keyboard appears or the device rotates.
What it covers
| Screenshot | The region is painted as a solid block. |
| Session replay | Nodes carry masked: true and paint as a block. |
| Console & network | Not covered — those are text streams. Use Redaction. |
That last row is the one to remember: this is about pixels. A card number
that also appears in a URLSession body needs a redaction rule as well.
Secure text fields
A UITextField with isSecureTextEntry is treated as sensitive automatically,
so you do not need to mark it. Anything else that happens to hold a secret does.
Choosing what to mark
Mark the smallest view that contains the secret. Masking a whole screen makes the report useless without making it meaningfully safer, and a blanked screenshot is a common reason a report gets closed as unreproducible.