While talking to developers we get a lot of questions on how to initialize a @StateObject with external values.

Today we update our docs by greatly expanding around all our data flow primitives with special attention to StateObject. You'll find better explanations on how to initialize StateObject with external data and few words around what to pay attention when doing so (https://developer.apple.com/documentation/swiftui/stateobject)

We hope this helps everyone get more clarity and understanding on how to work with SwiftUI.

StateObject | Apple Developer Documentation

A property wrapper type that instantiates an observable object.

Apple Developer Documentation
@lucabernardi I think the developers that asked these questions don't understand that @StateObject is a source of truth (the reference type equivalent of @State) so should not depend on any initialisation parameters. If it needs a parameter, it should simply be moved up in the hierarchy so its properties can be set. It is extremely likely these developers are misusing @StateObject for a legacy view model object instead of learning the View struct's features like diffing and dependency tracking.
@malhal @lucabernardi as someone who has asked this question in the past, I completely understand the point that @StateObject is like @State but for reference types now. I think it’s worth a discussion and how the alternatives may be used, especially for those looking into injecting values into the view model without having to rely on optionals.