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