As said by the error and @OOPer you can't have StateObject in a non-view.
It looks like RefactorAccounts is a StateObject for the second unnamed code block, the first view code block, what is it named? With that, please provide class/struct names in the future it's hard to understand what is happening without that, also hard to reference it in discussion.
Make RefactorAccounts more like this:
class RefactorAccounts: ObservableObject {
///Takes object from @StateObject, presents as var
@Published var accountBackEnd = AccountBackEnd()
///Calls to Class for published objects
@Published var publishedClasses = PublishedClassAccount()
Also, add 3 slashes to the line(s) directly above a var/func/struct/class/enum/etc. declaration to add to the quick documentation that appears when you hover over code(also in the right hand side of xcode in the doc pane view)
PublishedClassAccount, and AccountBackEnd will need to become ObservaleObjects themselves and use the @Published annotation on their own properties.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: