Instance Method インスタンスメソッド

privacySensitive(_:)

Marks the view as containing sensitive, private user data.

Declaration 宣言

func privacySensitive(_ sensitive: Bool = true) -> some View

Discussion 議論

SwiftUI redacts views marked with this modifier when you apply the privacy redaction reason.


struct BankAccountView: View {
    var body: some View {
        VStack {
            Text("Account #")


            Text(accountNumber)
                .font(.headline)
                .privacySensitive() // Hide only the account number.
        }
    }
}