Multiplatform App Tutorial: SwiftUI and Xcode 12 | raywenderlich.com

Learn how to use Xcode 12’s multiplatform app template and SwiftUI to write a single app that runs on every Apple platform.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/19611194-multiplatform-app-tutorial-swiftui-and-xcode-12

I was looking at the keyboard shortcut for clearing the favorites. When the favorites list is visible, the Core Data objects are updated (cleared) but the list does not update to an empty list. I tried adding a ‘try save’ after the batchUpdateRequest but no luck. Any idea how to propagate that change through to the UI so the list reflects the clearance immediately?

Hi @magnas
This might be a bug in SwiftUI and Core Data when updating the published property. A way to handle this would be manually telling the view to update by using objectWillChange.send(). This is just a workaround to manually update the state of the view. Usually, SwiftUI already does this under the hood.