I was having the exact same issue, and I found a fix for it.
In the project settings, I went to Build Settings -> Swift Compiler - Concurrency -> Default Actor Isolation
I was only able to get it to work with this set to nonisolated, which is what the sample project also has this set to.
Topic:
UI Frameworks
SubTopic:
SwiftUI