From f433dca1bb8ccd7b46b60934c20ae9015e97662b Mon Sep 17 00:00:00 2001 From: Trey t Date: Tue, 25 Nov 2025 18:32:00 -0600 Subject: [PATCH] Add iOS Password AutoFill support for login and registration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable system-level password generation and iCloud Keychain integration: RegisterView: - Add .textContentType(.username) to username field - Add .textContentType(.emailAddress) to email field - Add .textContentType(.newPassword) to password fields for Strong Password - iOS will suggest secure passwords and offer to save to Keychain LoginView: - Add .textContentType(.username) to email/username field - Add .textContentType(.password) to password fields - Enables AutoFill from saved Keychain credentials 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- iosApp/iosApp/Login/LoginView.swift | 3 +++ iosApp/iosApp/Register/RegisterView.swift | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/iosApp/iosApp/Login/LoginView.swift b/iosApp/iosApp/Login/LoginView.swift index d7827bf..56094ce 100644 --- a/iosApp/iosApp/Login/LoginView.swift +++ b/iosApp/iosApp/Login/LoginView.swift @@ -89,6 +89,7 @@ struct LoginView: View { .textInputAutocapitalization(.never) .autocorrectionDisabled() .keyboardType(.emailAddress) + .textContentType(.username) .focused($focusedField, equals: .username) .submitLabel(.next) .onSubmit { @@ -126,6 +127,7 @@ struct LoginView: View { TextField("Enter your password", text: $viewModel.password) .textInputAutocapitalization(.never) .autocorrectionDisabled() + .textContentType(.password) .focused($focusedField, equals: .password) .submitLabel(.go) .onSubmit { @@ -134,6 +136,7 @@ struct LoginView: View { .accessibilityIdentifier(AccessibilityIdentifiers.Authentication.passwordField) } else { SecureField("Enter your password", text: $viewModel.password) + .textContentType(.password) .focused($focusedField, equals: .password) .submitLabel(.go) .onSubmit { diff --git a/iosApp/iosApp/Register/RegisterView.swift b/iosApp/iosApp/Register/RegisterView.swift index dbdf164..dac5597 100644 --- a/iosApp/iosApp/Register/RegisterView.swift +++ b/iosApp/iosApp/Register/RegisterView.swift @@ -37,6 +37,7 @@ struct RegisterView: View { TextField("Username", text: $viewModel.username) .textInputAutocapitalization(.never) .autocorrectionDisabled() + .textContentType(.username) .focused($focusedField, equals: .username) .submitLabel(.next) .onSubmit { @@ -48,6 +49,7 @@ struct RegisterView: View { .textInputAutocapitalization(.never) .autocorrectionDisabled() .keyboardType(.emailAddress) + .textContentType(.emailAddress) .focused($focusedField, equals: .email) .submitLabel(.next) .onSubmit { @@ -60,7 +62,10 @@ struct RegisterView: View { .listRowBackground(Color.appBackgroundSecondary) Section { + // Using .newPassword enables iOS Strong Password generation + // iOS will automatically offer to save to iCloud Keychain after successful registration SecureField("Password", text: $viewModel.password) + .textContentType(.newPassword) .focused($focusedField, equals: .password) .submitLabel(.next) .onSubmit { @@ -69,6 +74,7 @@ struct RegisterView: View { .accessibilityIdentifier(AccessibilityIdentifiers.Authentication.registerPasswordField) SecureField("Confirm Password", text: $viewModel.confirmPassword) + .textContentType(.newPassword) .focused($focusedField, equals: .confirmPassword) .submitLabel(.go) .onSubmit { @@ -78,7 +84,7 @@ struct RegisterView: View { } header: { Text("Security") } footer: { - Text("Password must be secure") + Text("Tap the password field for a strong password suggestion") } .listRowBackground(Color.appBackgroundSecondary)