the.bay.news

How to correctly use index in forEach?

Swift Forums
How to correctly use index in forEach?
struct foreachTestinDubled: View { @State private var data: [String] = ["1", "2"] var body: some View { ZStack { ForEach(Array(data.enumerated()), id: \.element) { item, instance in tst(data: $data, item: item) } } } } #Preview { foreachTestinDubled() } struct tst: View { @Binding var data: [String] let item: Int @State private var offSet: CGSi...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.