Post not yet marked as solved
Post marked as unsolved with 5 replies, 3,151 views
It's my understanding that when a view contains an EnvironmentObject and the object changes in any way, the view should refresh. Is that right?I've got the following view:struct ContentView: View { @EnvironmentObject var globalInfo: appInfo var body: some View { NavigationView { List { ForEach(globalInfo.users.indices, id: \.self) { idx in NavigationLink(destination: UserView(idx: idx)) { Text(self.globalInfo.users[idx]) } } } .navigationBarItems(leading: NavigationLink(destination: AllUserView()) { Text("Show") }, trailing: NavigationLink(destination: NewUserView()) { Text("Add") }) } }}UserView and NewUserView include the same EnvironmentObject declaration and everything seems to be working fine. With breakpoints or using the AllUserView, I can see that changes or additions I make are getting correctly reflected in appInfo, but the list of names in this view never get updated. I've stripped everything out of my app down to this minimal implementation to try to understand the issue but I'm obviously missing something.