Fixed hide disclosure triangle for Bank- and BankAccountListItems (issue was that you have to use "ForEach(0 ..< array.count) { index in" instead of "ForEach(array) item in" - very obvious, Apple!)

This commit is contained in:
dankito 2020-07-26 15:14:03 +02:00
parent 185e0e0271
commit 70b8a8b84c
3 changed files with 14 additions and 6 deletions

View File

@ -13,8 +13,8 @@ struct AccountsTab: View {
VStack { VStack {
if data.banks.isEmpty == false { if data.banks.isEmpty == false {
Form { Form {
ForEach(data.banks) { bank in ForEach(0 ..< data.banks.count) { bankIndex in
BankListItem(bank: bank) BankListItem(bank: self.data.banks[bankIndex])
} }
} }
} }

View File

@ -8,11 +8,15 @@ struct BankAccountListItem : View {
var body: some View { var body: some View {
NavigationLink(destination: AccountTransactionsDialog(title: account.displayName, transactions: account.bookedTransactions)) { ZStack {
HStack { HStack {
Text(account.displayName) Text(account.displayName)
Spacer() Spacer()
}.frame(height: 35) }.frame(height: 35)
NavigationLink(destination: AccountTransactionsDialog(title: account.displayName, transactions: account.bookedTransactions)) {
EmptyView()
}
} }
} }

View File

@ -9,18 +9,22 @@ struct BankListItem : View {
var body: some View { var body: some View {
Section { Section {
NavigationLink(destination: AccountTransactionsDialog(title: bank.displayName, transactions: bank.accounts.flatMap { $0.bookedTransactions })) { ZStack {
HStack { HStack {
Text(bank.displayName) Text(bank.displayName)
.font(.headline) .font(.headline)
Spacer() Spacer()
}.frame(height: 35) }.frame(height: 35)
NavigationLink(destination: AccountTransactionsDialog(title: bank.displayName, transactions: bank.accounts.flatMap { $0.bookedTransactions })) {
EmptyView()
}
} }
ForEach(bank.accounts) { account in ForEach(0 ..< bank.accounts.count) { accountIndex in
BankAccountListItem(account: account) BankAccountListItem(account: self.bank.accounts[accountIndex])
} }
.padding(.leading, 18) .padding(.leading, 18)
} }