// // LoginView.swift // Build lego // // Created by Davy Chiang on 1/12/2023. // import SwiftData import SwiftUI var viewModel = File1() struct LoginView: View { var body: some View { NavigationView{ VStack{ //Lego brick picture ZStack{ RoundedRectangle(cornerRadius: 0) .foregroundColor(Color.green) VStack{ Text("Bricks build") .font(.system(size: 50)) .foregroundColor(Color.blue) } } HStack{ if viewModel.errorMessage.isEmpty { Text(viewModel.errorMessage) .foregroundColor(Color.red) } TextField("User name",text: viewModel.email) .textFieldStyle(DefaultTextFieldStyle()) .autocorrectionDisabled() .autocapitalization(.none) SecureField("password", text: viewModel.password) .textFieldStyle(DefaultTextFieldStyle()) .autocorrectionDisabled() .autocapitalization(.none) Button{ viewModel.login() } label:{ ZStack{ RoundedRectangle(cornerRadius: 10) .foregroundColor(Color.blue) Text("Start Building") .foregroundColor(Color.black) .bold() } } } VStack{ Text("Want to build bricks here?") NavigationLink("Create An Account", destination: newUserView()) } } } } } #Preview { LoginView() }