From 84790080be95d55a9eab7eeca65f4db85b6a66d1 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 25 Apr 2022 15:20:19 +0200 Subject: [PATCH] Disable autocorrection on profile name --- Passepartout/App/Constants/Theme.swift | 5 +++++ Passepartout/App/Views/AddProfileView.swift | 1 + Passepartout/App/Views/ProfileView+Rename.swift | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Passepartout/App/Constants/Theme.swift b/Passepartout/App/Constants/Theme.swift index d71a34ac..403f7fe8 100644 --- a/Passepartout/App/Constants/Theme.swift +++ b/Passepartout/App/Constants/Theme.swift @@ -401,6 +401,11 @@ extension View { // MARK: Validation extension View { + func themeProfileName() -> some View { + autocapitalization(.none) + .disableAutocorrection(true) + } + func themeURL(_ urlString: String?) -> some View { themeValidating(urlString, validator: Validators.url) .keyboardType(.asciiCapable) diff --git a/Passepartout/App/Views/AddProfileView.swift b/Passepartout/App/Views/AddProfileView.swift index bc7d32e4..093769a2 100644 --- a/Passepartout/App/Views/AddProfileView.swift +++ b/Passepartout/App/Views/AddProfileView.swift @@ -44,6 +44,7 @@ enum AddProfileView { footer: themeErrorMessage(errorMessage) ) { TextField(L10n.Global.Placeholders.profileName, text: $profileName, onCommit: onCommit) + .themeProfileName() } } } diff --git a/Passepartout/App/Views/ProfileView+Rename.swift b/Passepartout/App/Views/ProfileView+Rename.swift index cae3139c..584ac854 100644 --- a/Passepartout/App/Views/ProfileView+Rename.swift +++ b/Passepartout/App/Views/ProfileView+Rename.swift @@ -49,7 +49,7 @@ extension ProfileView { header: Text(L10n.Profile.Alerts.Rename.title) ) { TextField(L10n.Global.Placeholders.profileName, text: $newName, onCommit: commitRenaming) - .disableAutocorrection(true) + .themeProfileName() .onAppear(perform: loadCurrentName) } }.themeSecondaryView()