diff --git a/enzevalos_iphone/SwiftUI/AccountSetup/AccountSetupView.swift b/enzevalos_iphone/SwiftUI/AccountSetup/AccountSetupView.swift index 02e6cf3381ff87fcf664da5051103c7f8a3888ae..85f3881cbbfd80d0b3e436dac98b9c0a3e11c027 100644 --- a/enzevalos_iphone/SwiftUI/AccountSetup/AccountSetupView.swift +++ b/enzevalos_iphone/SwiftUI/AccountSetup/AccountSetupView.swift @@ -101,13 +101,13 @@ struct AccountSetupView: View { .font(.system(size: 55)) .fontWeight(.heavy) - self.inputField(label: NSLocalizedString("Emailaddress", comment: ""), defaultValue: "alice", variable: self.$login) + self.inputField(label: NSLocalizedString("Emailaddress", comment: ""), defaultValue: "alice", variable: self.$login, keyboardType: .emailAddress) self.passwordField self.advancedSectionSwitch if self.isDetailed { - self.detailedInput(label: NSLocalizedString("Username", comment: ""), defaultValue: NSLocalizedString("Emailaddress", comment: ""), variable: self.$username) + self.detailedInput(label: NSLocalizedString("Username", comment: ""), defaultValue: NSLocalizedString("Emailaddress", comment: ""), variable: self.$username, keyboardType: .emailAddress) Text("IMAP") .font(.headline) self.serverConfig(type: ServerConfigType.IMAP) @@ -126,9 +126,9 @@ struct AccountSetupView: View { let isIMAP = type == ServerConfigType.IMAP return VStack { // Server address - detailedInput(label: type.serverName, defaultValue: type.serverExample, variable: isIMAP ? $imapServer : $smtpServer) + detailedInput(label: type.serverName, defaultValue: type.serverExample, variable: isIMAP ? $imapServer : $smtpServer, keyboardType: .URL) // Port - detailedInput(label: type.portName, defaultValue: type.portExample, variable: isIMAP ? $imapPort : $smtpPort) + detailedInput(label: type.portName, defaultValue: type.portExample, variable: isIMAP ? $imapPort : $smtpPort, keyboardType: .numberPad) // TLS/SSL or plain? Text(type.transportEncName) .padding(.top , bigspace) @@ -208,6 +208,7 @@ struct AccountSetupView: View { .foregroundColor(Color.black) .clipShape(RoundedRectangle(cornerRadius: 8)) .shadow(radius: 8) + .keyboardType(.default) } else { TextField(label, text: $password) .padding(EdgeInsets(top: 8, leading:10, bottom: 8, trailing: 0)) @@ -215,6 +216,7 @@ struct AccountSetupView: View { .foregroundColor(Color.black) .clipShape(RoundedRectangle(cornerRadius: 8)) .shadow(radius: 8) + .keyboardType(.default) } Button(action: { self.securePasswordInput.toggle() @@ -244,17 +246,19 @@ struct AccountSetupView: View { .padding(bigspace) } - func inputField(label: String, defaultValue: String, variable: Binding<String>) -> some View { + func inputField(label: String, defaultValue: String, variable: Binding<String>, keyboardType: UIKeyboardType) -> some View { TextField(label, text: variable) + .keyboardType(keyboardType) .padding(EdgeInsets(top: 8, leading:10, bottom: 8, trailing: 10)) .background(Color.white) .foregroundColor(Color.black) .clipShape(RoundedRectangle(cornerRadius: 8)) .shadow(radius: 8) .padding(bigspace) + } - func detailedInput(label: String, defaultValue: String, variable: Binding<String>) -> some View { + func detailedInput(label: String, defaultValue: String, variable: Binding<String>, keyboardType: UIKeyboardType) -> some View { HStack { Text(label + ":") .padding(EdgeInsets(top: 8, leading:10, bottom: 8, trailing: 0)) @@ -264,6 +268,8 @@ struct AccountSetupView: View { .foregroundColor(Color.black) .clipShape(RoundedRectangle(cornerRadius: 8)) .shadow(radius: 8) + .keyboardType(keyboardType) + } .padding(bigspace) }