Hiding keyboard when adding account or transferring money

This commit is contained in:
dankito 2020-09-03 13:36:08 +02:00
parent 8a2875dd41
commit c9ed160043
3 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,19 @@
import SwiftUI
extension UIApplication {
static func hideKeyboard() {
shared.hideKeyboard()
}
func hideKeyboard() {
sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
}
extension UIResponder {
@discardableResult func focus() -> Bool {

View File

@ -87,6 +87,7 @@ struct AddAccountDialog: View {
func addAccount() {
if let bank = bank {
isTryingToAddAccount = true
UIApplication.hideKeyboard()
presenter.addAccountAsync(bankInfo: bank, customerId: customerId, pin: password) { (response) in
self.handleAddAccountResponse(response)

View File

@ -376,6 +376,7 @@ struct TransferMoneyDialog: View {
private func transferMoney() {
if let amount = inputValidator.convertAmountString(enteredAmountString: self.amount) {
isTransferringMoney = true
UIApplication.hideKeyboard()
let data = TransferMoneyData(account: account!, creditorName: remitteeName, creditorIban: remitteeIban, creditorBic: remitteeBic, amount: amount, usage: usage, instantPayment: instantPayment)