Basic List Navigation (iOS 14) and some CRUD #1810
-
I am a super-noob when it comes to SwiftUI but I've been using TCA with UIKit for a little while. I'm trying to get a bit of experience with SwiftUI so I'm remaking some simple features. I have a list of saved network credentials ( For this basic navigation scenario I have something like this: WithViewStore(store) { viewStore in
List {
ForEachStore(
store.scope(state: \.networks,
action: SavedNetworks.Action.networkDetailsAction(id:action:)))
{ network in
NavigationLink(
destination: NetworkDetailView(store: network))
{
Text(ViewStore(network).name)// This viewstore part feels like a hack to get to the network name
}
}
}
} Is that right? In the Navigate and Load case study it does something like a Given the above (if it's in fact correct):
Sorry if this is all a bit ignorant. I did enjoy the UI building part of SwiftUI so far, but handling the data flows and integrating it with TCA has been a bit trickier. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
For some reason I think that when I delete the model used in the Detail view from the parent collection that the Detail view should automatically be popped off. When I run this feature in an independent preview app that's what happens. But when I embed the feature in to my (mostly UIKit) app using Maybe I've got some of the wiring wrong. |
Beta Was this translation helpful? Give feedback.
-
I fixed both issues as described here: I had to set the Not sure if this is the correct way to handle this stuff but it works satisfactorily. |
Beta Was this translation helpful? Give feedback.
I fixed both issues as described here:
#1817 (comment)
I had to set the
confirmationDialog
state tonil
before sending thedeleteConfirmed
action in the parent reducer. And then I did a manual dismiss of the detail view before sending thedeleteConfirmed
so that the parent would receive no more actions from the now deleted child.Not sure if this is the correct way to handle this stuff but it works satisfactorily.