Extensions.swift 460 B

12345678910111213141516171819
  1. import SwiftUI
  2. struct DisableAutocapitalizationModifier: ViewModifier {
  3. func body(content: Content) -> some View {
  4. if #available(iOS 15.0, *) {
  5. content
  6. .textInputAutocapitalization(.never)
  7. } else {
  8. content
  9. .autocapitalization(.none)
  10. }
  11. }
  12. }
  13. extension View {
  14. func disableAutocapitalization() -> some View {
  15. modifier(DisableAutocapitalizationModifier())
  16. }
  17. }