struct ProfileEditView: View {
@ObservedObject var viewModel: UsersViewModel
@StateObject var auth: Authenticator
@State var showingImageEditor: Bool = false
init(_ viewModel: UsersViewModel, _ auth: Authenticator) {
self.viewModel = viewModel
self.auth = auth
UITableView.appearance().backgroundColor = UIColor.clear
UITableViewCell.appearance().selectionStyle = .none
}
var body: some View { }
}
I am trying to manually intialize a view that takes a StateObject as a parameter. I am getting an error: Cannot assign to property: 'auth' is a get-only property. What is the proper way to write the initializer?