I have something like a List of items (though actually I’m currently using a ForEach). When the user taps one of them it expands, revealing more information. I’m currently using a @FocusState to keep track of which one has been tapped and expanded.
The focus state of each item is identified by a UUID from the model.
When an item expands, it has a couple of TextFields. The problem I’m finding is that those TextFields then need their own @FocusState in turn, so that I can control their focus programatically.
But this means that there are two nested levels of focus: first the outer view, and then each inner text field.
When one of the text fields with the .focussable modifier on it receives focus, it then removes focus from the outer view, causing it to collapse.
Is there a way to have multiple focus states simultaneously that are nested? Or am I thinking about this wrong?
2