static var disabled: DisabledTextSelectability
A selectability value that disables text selection by the person using your app.
Available when
Self
is DisabledTextSelectability
.Availability 有効性
Technology
static var enabled: EnabledTextSelectability
{ get }
Self
is EnabledTextSelectability
.Enabling text selection allows people to perform actions on the text content, such as copying and sharing. Enable text selection in views where those operations are useful, such as copying unique IDs or error messages. This allows people to paste the data into emails or documents.
The following example enables text selection on the second of two Text
views in a VStack
.
VStack {
Text("Event Invite")
.font(.title)
Text(invite.date.formatted(date: .long, time: .shortened))
.textSelection(.enabled)
}
static var disabled: DisabledTextSelectability
Self
is DisabledTextSelectability
.