no exact matches in reference to static method 'buildExpression'

This error ( no exact matches in reference to static method 'buildExpression' ) keeps occurring in my content view on the line that states .environmentObject(registrationViewModel).

Here is the ContentView code:

import SwiftUI

struct ContentView: View {
    @StateObject var viewModel = ContentViewModel()
    @StateObject var registrationViewModel = RegistrationViewModel()
    
    var body: some View {
        Group {
            if viewModel.userSession == nil {
                LoginView()
                    .environmentObject(registrationViewModel)
            } else if let currentUser = viewModel.currentUser {
                MainTabView(user: currentUser)
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
            ContentView()
    }
}

Here is the RegistrationViewModel code:

import Foundation

class RegistrationViewModel: ObservableObject {
    @Published var username = ""
    @Published var email = ""
    @Published var password = ""
    
    func createUser() async throws {
        try await AuthService.shared.createUser(email: email, password: password, username: username)
        
    }
}



Here is some more info about the error:

Candidate requires that 'some View' conform to 'CustomizableToolbarContent' (requirement specified as 'Content' : 'CustomizableToolbarContent')

Candidate requires that 'some View' conform to 'CustomizableToolbarContent' (requirement specified as 'Content' : 'CustomizableToolbarContent')

Candidate requires that 'some View' conform to 'TableRowContent' (requirement specified as 'Content' : 'TableRowContent')

Candidate requires that 'some View' conform to 'Commands' (requirement specified as 'Content' : 'Commands')

I have been trying to figure out this error for 2 days! Please help!

Thanks

I don't see anything that particularly stands out in the code you provided, but if I were to hazard a guess here, it might be a problem with LoginView or MainTabView. If you're creating a toolbar with the toolbar modifier, and you're mixing and matching IDs, you'll need to make sure each toolbar item has an ID on it:

MyView()
    .toolbar {
        ToolbarItem(id: "some-value") { ... }
        ToolbarItem(id: "some-other-value") { ... }
        ToolbarItem(id: "yet-another-value") { ... }
    }

There's also an error regarding the contents of a Table, so you may need to look into that as well.

Did you ever figure this one out? I'm getting same errors ...

no exact matches in reference to static method 'buildExpression'
 
 
Q