Ok. I posted It below so I was able to fit all the code in it.
Post
Replies
Boosts
Views
Activity
Of course! The error occurs on the line that says .environmentObject(registrationViewModel)
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()
}
}