ScrollDismissesKeyboardMode.swift 1.3 KB

12345678910111213141516171819202122232425262728
  1. /// The ways that scrollable content can interact with the software keyboard.
  2. ///
  3. /// Use this type in a call to the ``View/scrollDismissesKeyboard(_:)``
  4. /// modifier to specify the dismissal behavior of scrollable views.
  5. public enum ScrollDismissesKeyboardMode: Sendable {
  6. /// Determine the mode automatically based on the surrounding context.
  7. ///
  8. /// Currently, this behaves the same as ``ScrollDismissesKeyboardMode/interactively``.
  9. /// In the future, it may adapt dynamically based on the context, similar to how
  10. /// SwiftUI's `.automatic` works (e.g., using `.interactively` in some views and
  11. /// `.immediately` in others). Using this value avoids source-breaking changes later on.
  12. case automatic
  13. /// Dismiss the keyboard as soon as scrolling starts.
  14. case immediately
  15. /// Enable people to interactively dismiss the keyboard as part of the
  16. /// scroll operation.
  17. ///
  18. /// The software keyboard's position tracks the gesture that drives the
  19. /// scroll operation if the gesture crosses into the keyboard's area of the
  20. /// display. People can dismiss the keyboard by scrolling it off the
  21. /// display, or reverse the direction of the scroll to cancel the dismissal.
  22. case interactively
  23. /// Never dismiss the keyboard automatically as a result of scrolling.
  24. case never
  25. }