Oh man, I'm really getting confused with this.
I got it working were I can now select a person from the list and then view that person in a separate view (using a NavigationLink).
But now when I try to "Edit" that person nothing happens. I am using a sheet to try and replicate the iOS Contacts app and have it like this...
.sheet(isPresented: viewStore.$isEditSheetPresented) {
PersonEditView(
store: store.scope(
state: \.personEditState,
action: PersonViewAction.editAction
)
)
}
I can see when I first tap on a person in the list the state shows isEditSheetPresented is false.
And I can see the action setting isEditSheetPresented to true.
But then it says (No state changes).

(Sorry, I couldn't paste this in a sensible format).
I tried updating to the new TCA from the latest videos but that had no effect.
However...
If I intercept that edit and also change the person's name then it does trigger a state update...
case .binding(\.$isEditSheetPresented):
state.person.name = "Bob"
return .none
... and it shows the edit screen. And I can edit the person.
But when I get back to the list it isn't updated there.
I think it's due to trying to force TCA to not use a nested structure.
I currently have in AppState...
var people: IdentifiedArrayOf<Person> = []
var selectedPersonState: PersonViewState?
var selectedPersonID: Person.ID?
I think I just need to change it to...
var people: IdentifiedArrayOf<PersonViewState> = []
But then I bring along with it all the extra data about the PersonView when I just want to display a list of people. I don't want all their info there too.
Hmm...
I feel like I'm not thinking the right way about this. It should be much simpler than I'm making it.