The attribute was added because the view model (which has the attribute) was being instantiated in the initializer, but it shouldn't have been. As specified in the doc, init(initialValue:) should not be called directly—state and state object properties should not be initialized in the enclosing object's initializer. This solves that problem and removes the MainActor attribute.
The attribute was added because the view model (which has the attribute) was being instantiated in the initializer, but it shouldn't have been. As specified in the doc,
init(initialValue:)
should not be called directly—state and state object properties should not be initialized in the enclosing object's initializer. This solves that problem and removes theMainActor
attribute.