privacySensitive() doesn't work

privacySensitive() doesn't work.

This is my code:

    VStack {
      Text("Card number")
        .font(.headline)
      Text("123 456 789")
        .font(.headline)
        .privacySensitive()
    }
  }

Simulator Version:

Version 13.0 (969) SimulatorKit 612 CoreSimulator 775

Xcode version: Version 13.0 beta 4 (13A5201i)

Applying the .privacySensitive() modifier won’t actually redact the text, it just tells SwiftUI that the text is privacy sensitive. To actually redact the text, apply the .redacted(reason: .privacy) somewhere higher up in the view hierarchy.

For example, in your case, you could add the .redacted(reason:) modifier to you’re VStack if you wanted to preview what it looks like.

Check out these links about more on how to use this modifier:

privacySensitive() doesn't work
 
 
Q