In my app the object collecting errors and messages is a global object and not living in the UI - it has to be. Also it shouldn't really matter. It is def a problem with the viewcontroller displaying the alert as it works with a delay. It's not a problem of the ObservedObject disappearing.
Post
Replies
Boosts
Views
Activity
StateObject would be appropriate if the object only lives in the UI - which it does not (and cannot) in my case.
In my (larger project app) the class collecting the messages is a Singleton and not strictly owned by the UI. The static var shared = Messages() should take care of the reference so that @StateObject would be wrong here.