跳转至
Structure

RedactionReasons

The reasons to apply a redaction to data displayed on screen.

Declaration

struct RedactionReasons : OptionSet

Overview

Use this type with the redacted(reason:) view modifier to "redact" a view's contents. For now, that simply means to replace the view with a placeholder.

In the future, this type may get more optionality, but as of now, the only redaction reason is placeholder

See the following example for adding redaction to a view.

struct RedactedView: View {
    var body: some View {
        VStack {
            Label("Taylor Swift", systemImage: "person.fill")
            Label("Kanye West", systemImage: "person.fill")
                .redacted(reason: .placeholder)
        }
    }
}
A screenshot displaying two labels in a VStack, each composed of a person icon followed by text. The first reads "Taylor Swift" next to the icon, while the second is redacted and has a gray square followed by a gray rectangle.

Availability

iOS 14.0+

macOS 11.0+

tvOS 14.0+

watchOS 7.0+

Topics


Initializer

init(rawValue:) Creates a new set from a raw value.


Type Alias

ArrayLiteralElement The type of the elements of an array literal.

Element The element type of the option set.

RawValue The raw type that can be used to represent all values of the conforming type.


Instance Property

rawValue The raw value.


Type Property

placeholder Displayed data should appear as generic placeholders.