On your example, the line where you'd pass the parameter to the view model is missing. Can you clarify? Because if you try to instantiate the view model and assign it to the StateObject during the init, it fails because the variable when annotated with StateObject is get-only.