SwiftUI viewWithTag

Is it possible to find a particular view in SwiftUI based on its tag ?


When a row on a List is tapped, I want the textField on a row in another List to be updated.

But the problem is I dont know how to get hold of the active textField or the index of the row in the other list.


Please refer this image for clarity https://imgur.com/a/Ovv8IBY

The 'swiftui'-ish way to do it, would be to declare a state variable, use the contents of that variable for your text field, and modify the contents of that variable from the list (possibly by embedding your List items in 'buttons' and utilizing their 'action's. As far as directly referencing the field, assign it to a variable. Then you can reference it directly in code.

let myTextField = textField()
SwiftUI viewWithTag
 
 
Q