commit 9eb8a7e7531ca11aa7178d1dc80cdffa546feff4 parent 15fc134132e6d973ce3b15c95af847f8ee0aa440 Author: Marc Stibane <marc@taler.net> Date: Wed, 12 Aug 2026 07:42:28 +0200 cleanup Diffstat:
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift b/TalerWallet1/Views/Balances/BalancesListView.swift @@ -50,7 +50,7 @@ struct BalancesListView: View { isEmpty: false, disabled: false) } - ForEachWithIndex(data: controller.balances) { index, balance in + ForEachWithIndex(array: controller.balances) { index, balance in BalancesSectionView(stack: stack.push("\(balance.scopeInfo.currency)"), balance: balance, // this is the currency to be used selectedBalance: $selectedBalance, // set in TransactionsListView diff --git a/TalerWallet1/Views/HelperViews/ForEachWithIndex.swift b/TalerWallet1/Views/HelperViews/ForEachWithIndex.swift @@ -23,13 +23,13 @@ import SwiftUI -struct ForEachWithIndex<Data: RandomAccessCollection, Content: View>: View - where Data.Element: Identifiable, Data.Element: Hashable { - let data: Data - @ViewBuilder let content: (Data.Index, Data.Element) -> Content +struct ForEachWithIndex<T: RandomAccessCollection, Content: View>: View + where T.Element: Identifiable, T.Element: Hashable { + let array: T + @ViewBuilder let content: (T.Index, T.Element) -> Content var body: some View { - ForEach(Array(zip(data.indices, data)), id: \.1) { index, element in + ForEach(Array(zip(array.indices, array)), id: \.1) { index, element in content(index, element) } } diff --git a/TalerWallet1/Views/HelperViews/ScopePicker.swift b/TalerWallet1/Views/HelperViews/ScopePicker.swift @@ -34,7 +34,7 @@ struct CurrencyPicker: View { var body: some View { Picker(EMPTYSTRING, selection: $selected) { - ForEachWithIndex(data: exchanges) { index, exchange in + ForEachWithIndex(array: exchanges) { index, exchange in if exchange.talerUri.contains("exchange.stage.taler-ops.ch") { Text(exchange.currencySpec.name + " (stage)") .tag(index) diff --git a/TalerWallet1/Views/OIM/OIMbalances.swift b/TalerWallet1/Views/OIM/OIMbalances.swift @@ -246,7 +246,7 @@ struct OIMbalances: View { // multiple savings chests (Euro, Sierra Leone, Côte d'Ivoire) Spacer() HStack(spacing: 30) { - ForEachWithIndex(data: controller.balances) { index, balance in + ForEachWithIndex(array: controller.balances) { index, balance in let oimCurrency = oimCurrency(balance.scopeInfo, oimEuro: oimEuro) let itsMe = selectedBalance == balance let isClosed = selectedBalance == nil diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift @@ -149,7 +149,7 @@ struct ExchangeListCommonV: View { } #endif let balanceList = List { - ForEachWithIndex(data: controller.balances) { index, balance in + ForEachWithIndex(array: controller.balances) { index, balance in ExchangeSectionView(stack: stack.push(), balance: balance, thousand: index * MAXEXCHANGES, // unique ID diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift @@ -99,7 +99,7 @@ struct ExchangeSectionView: View { let scopeInfo = balance.scopeInfo let currency = scopeInfo.currency Section { - ForEachWithIndex(data: exchanges) { index, exchange in + ForEachWithIndex(array: exchanges) { index, exchange in let _ = symLog.log("Index: \(thousand + index)") ExchangeRowView(stack: stack.push(), exchange: exchange,