Ím trying to refresh this List whenever I click on a NavLink
NavigationView {
List(feed.items.indices, id:\\.self) { i in
NavigationLink(destinat
I had a similar problem, this is the hack I came up with.
In your "TestView" declare:
@State var needRefresh: Bool = false
Pass this to your "detailView" destination, such as:
NavigationLink(destination: detailView(feed: self._feed, i: i, needRefresh: self.$needRefresh)) {
HStack {
Text(self.feed.items[i].text)
Text("(\(self.feed.items[i].read.description))")
}.accentColor(self.needRefresh ? .white : .black)
}
Note ".accentColor(self.needRefresh ? .white : .black)" to force a refresh when "needRefresh" is changed.
In your "detailView" destination add:
@Binding var needRefresh: Bool
Then in your "detailView" in your Button action, add:
self.needRefresh.toggle()