THIS CODE didn't WORK I want someone told me why
`import SwiftUI
struct SettingsView: View { @State var name: String = "" @State var password: String = "" @State var id: String = "" @State var email: String = "" @State var phoneNumber: String = "" @State var contract: Bool = false
var body: some View {
VStack(alignment: .leading, spacing: 20) {
Text("Settings")
.font(.largeTitle)
.bold()
HStack(spacing: 20) {
Image(systemName: "person.fill")
.resizable()
.frame(width: 50, height: 50)
VStack(alignment: .leading, spacing: 5) {
Text("John Doe")
.font(.headline)
Text("johndoe@gmail.com")
.font(.subheadline)
.foregroundColor(.gray)
}
Spacer()
Image(systemName: "pencil")
.foregroundColor(.blue)
}
Divider()
Text("Account Information")
.font(.headline)
VStack(alignment: .leading, spacing: 10) {
TextField("Name", text: $name)
.textFieldStyle(RoundedBorderTextFieldStyle())
SecureField("Password", text: $password)
.textFieldStyle(RoundedBorderTextFieldStyle())
TextField("ID", text: $id)
.textFieldStyle(RoundedBorderTextFieldStyle())
TextField("Email", text: $email)
.textFieldStyle(RoundedBorderTextFieldStyle())
TextField("Phone Number", text: $phoneNumber)
.textFieldStyle(RoundedBorderTextFieldStyle())
}
Divider()
VStack(alignment: .leading, spacing: 10) {
Toggle(isOn: $contract) {
Text("Contract")
.font(.headline)
}
Button(action: {
// Log out action
}) {
Text("Log Out")
.fontWeight(.semibold)
.frame(minWidth: 0, maxWidth: .infinity)
.padding()
.foregroundColor(.white)
.background(Color.blue)
.cornerRadius(40)
}
}
Spacer()
}
.padding()
}
}