diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift index ce1d6c36..12302909 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift @@ -13,7 +13,6 @@ struct TransferMoneyDialog: View { private var accountsSupportingTransferringMoney: [BUCBankAccount] = [] @State private var selectedAccountIndex = 0 - private var account: BUCBankAccount? = nil @State private var remitteeName: String = "" @State private var isValidRemitteeNameEntered = false @@ -32,30 +31,35 @@ struct TransferMoneyDialog: View { @State private var instantPayment = false + @State private var transferMoneyResponseMessage: Message? = nil + + + private var account: BUCBankAccount? { + if (self.selectedAccountIndex < self.accountsSupportingTransferringMoney.count) { + return self.accountsSupportingTransferringMoney[selectedAccountIndex] + } + + return self.accountsSupportingTransferringMoney.first + } private var supportsInstantPayment: Bool { return self.account?.supportsInstantPaymentMoneyTransfer ?? false } - @State private var transferMoneyResponseMessage: Message? = nil - - @Inject private var presenter: BankingPresenterSwift init() { self.accountsSupportingTransferringMoney = self.presenter.bankAccounts.filter({ $0.supportsTransferringMoney }) - self.account = self.accountsSupportingTransferringMoney.first - self.showAccounts = self.accountsSupportingTransferringMoney.count > 1 } var body: some View { Form { - if (showAccounts) { + if showAccounts { Section { Picker("Account", selection: $selectedAccountIndex) { ForEach(0 ..< self.accountsSupportingTransferringMoney.count) { accountIndex in