Add show/hide password for feedbin account view

This commit is contained in:
Rizwan Mohamed Ibrahim 2020-07-13 20:52:05 +05:30
parent 17e1247ff0
commit b95697bf0d
No known key found for this signature in database
GPG Key ID: D5BEE468D448BCC5
2 changed files with 14 additions and 1 deletions

View File

@ -41,6 +41,7 @@ class SettingsFeedbinAccountModel: ObservableObject {
} }
} }
@Published var showError: Bool = false @Published var showError: Bool = false
@Published var showPassword: Bool = false
init() { init() {

View File

@ -30,8 +30,20 @@ struct SettingsFeedbinAccountView: View {
List { List {
Section(header: AccountHeaderImageView(image: AppAssets.image(for: .feedbin)!)) { Section(header: AccountHeaderImageView(image: AppAssets.image(for: .feedbin)!)) {
TextField("Email", text: $settingsModel.email).textContentType(.emailAddress) TextField("Email", text: $settingsModel.email).textContentType(.emailAddress)
HStack {
if settingsModel.showPassword {
TextField("Password", text:$settingsModel.password)
}
else {
SecureField("Password", text: $settingsModel.password) SecureField("Password", text: $settingsModel.password)
} }
Button(action: {
settingsModel.showPassword.toggle()
}) {
Text(settingsModel.showPassword ? "Hide" : "Show")
}
}
}
Section(footer: errorFooter) { Section(footer: errorFooter) {
HStack { HStack {
Spacer() Spacer()