Fixed that AccountTransactionsDialog got eagerly created and selected bank account(s) therefore set to bank account(s) of last created AccountTransactionsDialog
This commit is contained in:
parent
6b3e4b65c3
commit
448ce54ae9
|
@ -13,6 +13,8 @@ struct AccountsTab: View {
|
|||
VStack {
|
||||
if data.banks.isEmpty == false {
|
||||
Form {
|
||||
AllBanksListItem(banks: data.banks)
|
||||
|
||||
ForEach(0 ..< data.banks.count) { bankIndex in
|
||||
BankListItem(bank: self.data.banks[bankIndex])
|
||||
}
|
||||
|
@ -24,7 +26,6 @@ struct AccountsTab: View {
|
|||
NavigationLink(destination: AddAccountDialog()) {
|
||||
Text("Add account")
|
||||
}
|
||||
.padding()
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import BankingUiSwift
|
|||
|
||||
struct BankAccountListItem : View {
|
||||
|
||||
var account: BankAccount
|
||||
let account: BankAccount
|
||||
|
||||
|
||||
var body: some View {
|
||||
|
@ -14,7 +14,7 @@ struct BankAccountListItem : View {
|
|||
Spacer()
|
||||
}.frame(height: 35)
|
||||
|
||||
NavigationLink(destination: AccountTransactionsDialog(account: account)) {
|
||||
NavigationLink(destination: LazyView(AccountTransactionsDialog(account: self.account))) {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import BankingUiSwift
|
|||
|
||||
struct BankListItem : View {
|
||||
|
||||
var bank: Customer
|
||||
let bank: Customer
|
||||
|
||||
|
||||
var body: some View {
|
||||
|
@ -17,7 +17,7 @@ struct BankListItem : View {
|
|||
Spacer()
|
||||
}.frame(height: 35)
|
||||
|
||||
NavigationLink(destination: AccountTransactionsDialog(bank: bank)) {
|
||||
NavigationLink(destination: LazyView(AccountTransactionsDialog(bank: self.bank))) {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
import SwiftUI
|
||||
|
||||
|
||||
struct LazyView<Content: View>: View {
|
||||
|
||||
private let build: () -> Content
|
||||
|
||||
init(_ build: @autoclosure @escaping () -> Content) {
|
||||
self.build = build
|
||||
}
|
||||
|
||||
var body: Content {
|
||||
build()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct LazyView_Previews: PreviewProvider {
|
||||
|
||||
static var previews: some View {
|
||||
LazyView(Text("Hello"))
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue