[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 06/18: ForEachWithIndex
From: |
gnunet |
Subject: |
[taler-taler-ios] 06/18: ForEachWithIndex |
Date: |
Thu, 19 Dec 2024 23:12:36 +0100 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit 661b668ada144806c28b469a7f98ccbd7098b043
Author: Marc Stibane <marc@taler.net>
AuthorDate: Thu Dec 19 18:53:42 2024 +0100
ForEachWithIndex
---
TalerWallet.xcodeproj/project.pbxproj | 6 ++++
.../Views/HelperViews/ForEachWithIndex.swift | 36 ++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/TalerWallet.xcodeproj/project.pbxproj
b/TalerWallet.xcodeproj/project.pbxproj
index 2e2365f..8ad7e43 100644
--- a/TalerWallet.xcodeproj/project.pbxproj
+++ b/TalerWallet.xcodeproj/project.pbxproj
@@ -314,6 +314,8 @@
4EEC3A722B2285A200D05F9D /* WithdrawExchangeV.swift in Sources
*/ = {isa = PBXBuildFile; fileRef = 4EEC3A702B2285A200D05F9D /*
WithdrawExchangeV.swift */; };
4EED38552D140C1400F6C038 /* NavigationModel.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4EED38542D140C1400F6C038 /*
NavigationModel.swift */; };
4EED38562D140C1400F6C038 /* NavigationModel.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4EED38542D140C1400F6C038 /*
NavigationModel.swift */; };
+ 4EED38582D1485AB00F6C038 /* ForEachWithIndex.swift in Sources
*/ = {isa = PBXBuildFile; fileRef = 4EED38572D1485AB00F6C038 /*
ForEachWithIndex.swift */; };
+ 4EED38592D1485AB00F6C038 /* ForEachWithIndex.swift in Sources
*/ = {isa = PBXBuildFile; fileRef = 4EED38572D1485AB00F6C038 /*
ForEachWithIndex.swift */; };
4EF840A72A0B85F400EE0D47 /* CopyShare.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4EF840A62A0B85F400EE0D47 /* CopyShare.swift */;
};
4EFA39602AA7946B00742548 /* ToSButtonView.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4EFA395F2AA7946B00742548 /* ToSButtonView.swift
*/; };
4EFA39612AA7946B00742548 /* ToSButtonView.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4EFA395F2AA7946B00742548 /* ToSButtonView.swift
*/; };
@@ -523,6 +525,7 @@
4EEC157929F9427F00D46A03 /* QRSheet.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= QRSheet.swift; sourceTree = "<group>"; };
4EEC3A702B2285A200D05F9D /* WithdrawExchangeV.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= WithdrawExchangeV.swift; sourceTree = "<group>"; };
4EED38542D140C1400F6C038 /* NavigationModel.swift */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.swift; path =
NavigationModel.swift; sourceTree = "<group>"; };
+ 4EED38572D1485AB00F6C038 /* ForEachWithIndex.swift */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.swift; path =
ForEachWithIndex.swift; sourceTree = "<group>"; };
4EF840A62A0B85F400EE0D47 /* CopyShare.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= CopyShare.swift; sourceTree = "<group>"; };
4EFA395F2AA7946B00742548 /* ToSButtonView.swift */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.swift; path =
ToSButtonView.swift; sourceTree = "<group>"; };
4EFFDD6A2A501121000C1C6A /* Localizable.xcstrings */ = {isa =
PBXFileReference; lastKnownFileType = text.json.xcstrings; path =
Localizable.xcstrings; sourceTree = "<group>"; };
@@ -883,6 +886,7 @@
4EF840A62A0B85F400EE0D47 /* CopyShare.swift */,
4E53A33629F50B7B00830EC2 /* CurrencyField.swift
*/,
4EA551242A2C923600FEC9A8 /*
CurrencyInputView.swift */,
+ 4EED38572D1485AB00F6C038 /*
ForEachWithIndex.swift */,
4E5D2C8A2C574CB0003F7A49 /*
GradientBorder.swift */,
4E0A71172C3AB099002485BB /* IconBadge.swift */,
4EB095432989CBFE0043A8A1 /*
LaunchAnimationView.swift */,
@@ -1240,6 +1244,7 @@
4E3EAE212A990778009F1BE8 /* Buttons.swift in
Sources */,
4E3EAE222A990778009F1BE8 /*
TransactionButton.swift in Sources */,
4EEC118D2B83DE4800146CFF /* AmountInputV.swift
in Sources */,
+ 4EED38582D1485AB00F6C038 /*
ForEachWithIndex.swift in Sources */,
4E77976F2C4BEA4E005D6ECB /* BalanceCellV.swift
in Sources */,
4E3EAE232A990778009F1BE8 /*
BalancesSectionView.swift in Sources */,
4E3EAE242A990778009F1BE8 /*
QRGeneratorView.swift in Sources */,
@@ -1380,6 +1385,7 @@
4EB0956A2989CBFE0043A8A1 /* Buttons.swift in
Sources */,
4EBA82AB2A3EB2CA00E5F39A /*
TransactionButton.swift in Sources */,
4EEC118E2B83DE4800146CFF /* AmountInputV.swift
in Sources */,
+ 4EED38592D1485AB00F6C038 /*
ForEachWithIndex.swift in Sources */,
4E7797702C4BEA4E005D6ECB /* BalanceCellV.swift
in Sources */,
4EB095602989CBFE0043A8A1 /*
BalancesSectionView.swift in Sources */,
4EEC157329F8242800D46A03 /*
QRGeneratorView.swift in Sources */,
diff --git a/TalerWallet1/Views/HelperViews/ForEachWithIndex.swift
b/TalerWallet1/Views/HelperViews/ForEachWithIndex.swift
new file mode 100644
index 0000000..1eb5dfd
--- /dev/null
+++ b/TalerWallet1/Views/HelperViews/ForEachWithIndex.swift
@@ -0,0 +1,36 @@
+/* MIT License
+ * Copyright (c) 2021 Khoa aka onmyway133
+ * https://onmyway133.com/posts/how-to-use-foreach-with-indices-in-swiftui/
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE
+ * SOFTWARE.
+ */
+
+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
+
+ var body: some View {
+ ForEach(Array(zip(data.indices, data)), id: \.1) { index, element in
+ content(index, element)
+ }
+ }
+}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (4b4d112 -> 1a6daf7), gnunet, 2024/12/19
- [taler-taler-ios] 04/18: terms for tx, gnunet, 2024/12/19
- [taler-taler-ios] 01/18: fix #9400, gnunet, 2024/12/19
- [taler-taler-ios] 08/18: A11Y VoiceOver dismiss button, gnunet, 2024/12/19
- [taler-taler-ios] 05/18: NavigationModel tosView, gnunet, 2024/12/19
- [taler-taler-ios] 09/18: hide tabBar in ToS, gnunet, 2024/12/19
- [taler-taler-ios] 02/18: isInternal #9332, gnunet, 2024/12/19
- [taler-taler-ios] 06/18: ForEachWithIndex,
gnunet <=
- [taler-taler-ios] 03/18: cleanup, gnunet, 2024/12/19
- [taler-taler-ios] 07/18: A11Y colors + fontsize, gnunet, 2024/12/19
- [taler-taler-ios] 10/18: API wording, gnunet, 2024/12/19
- [taler-taler-ios] 12/18: L10N, gnunet, 2024/12/19
- [taler-taler-ios] 11/18: exportDbToFile, gnunet, 2024/12/19
- [taler-taler-ios] 18/18: Bump version to 0.14.1 (0.14.1), gnunet, 2024/12/19
- [taler-taler-ios] 15/18: loc, gnunet, 2024/12/19
- [taler-taler-ios] 17/18: L10N, gnunet, 2024/12/19
- [taler-taler-ios] 13/18: withTerms, gnunet, 2024/12/19
- [taler-taler-ios] 16/18: cleanup, gnunet, 2024/12/19