I want to use the method 'ForEach(data.arr[0], id: \.self { item in' to take advantage of the .onDelete { indices in method
Im pretty sure onDelete is refering to indices that were communicated by the ForEach method
using another ForEach method ie ForEach(data.arr[0] { i in is great in terms of identifying the indexes, except it breaks the onDelete method
So I was thinking I could just throw a counter in to the forEach method, because I'm still becoming familiar with Swifts architecture to be honest I have no Idea how to simply apply that concept.
private var index: Int = 0 ForEach(data.array[0], id: \.self) { item in index += 1 TextField("FieldName", text: $data.arr[0][index][0]) CheckBoxFromString(isSetString: $data.arr[0][index][2])
but it seems it's not approachable in this way because it creates a conflict for the 'View' class
i need to correctly identify the index so I can apply binding to it $data.arr[0][index][0]
The following methods require binding in order to operate
a) TextField()
b) CheckBoxFromString()
Is that a bit clearer?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: