TextSelectionModifier.swift 424 B

12345678910111213
  1. extension View {
  2. /// Sets selectability of contained text. Ignored on tvOS.
  3. ///
  4. /// - Parameter isEnabled: Whether text selection is enabled.
  5. public func textSelectionEnabled(_ isEnabled: Bool = true) -> some View {
  6. EnvironmentModifier(
  7. self,
  8. modification: { environment in
  9. environment.with(\.isTextSelectionEnabled, isEnabled)
  10. }
  11. )
  12. }
  13. }