SwiftUI's List View Not Updating on macOS 13.2 After State Change
I've tried everything I can think of but I've looked through the documentation and I'm still confused about I'm experiencing an issue where a `List` in my SwiftUI macOS application does not update properly when the underlying data changes... I'm using macOS 13.2 and Swift 5.7. The data is stored in an `ObservableObject`, and I'm using `@Published` to trigger the view updates. Here's a simplified version of the code: ```swift import SwiftUI import Combine class ItemList: ObservableObject { @Published var items: [String] = [] func addItem(_ item: String) { items.append(item) } } struct ContentView: View { @StateObject private var itemList = ItemList() var body: some View { VStack { List(itemList.items, id: \.(self)) { item in Text(item) } Button("Add Item") { itemList.addItem("New Item") } } } } ``` When I press the "Add Item" button, I expect the new item to appear in the `List`, but it does not update visually. I can confirm that the `items` array does get updated, as I printed the contents to the console and they reflect the expected changes. I've tried using `self.objectWillChange.send()` manually in the `addItem` method, but that didn't help either. I also verified that there are no issues with the view hierarchy and that `ContentView` is properly set up as the main view. Interestingly, the same `List` works as expected when tested on iOS. Has anyone encountered this issue on macOS or knows why the `List` might not be refreshing? Any insights would be greatly appreciated! The stack includes Swift and several other technologies. Is there a simpler solution I'm overlooking? The stack includes Swift and several other technologies. What's the best practice here? Could someone point me to the right documentation?