diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountsTab.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountsTab.swift index c8d880ef..1d21761f 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountsTab.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountsTab.swift @@ -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() } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift index 1508d36d..04ad101b 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift @@ -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() } } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift index 9f871054..6a9cef6f 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift @@ -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() } } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/LazyView.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/LazyView.swift new file mode 100644 index 00000000..8974ea9c --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/LazyView.swift @@ -0,0 +1,24 @@ +import SwiftUI + + +struct LazyView: 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")) + } + +}