When I put this "https://imgur.com/undefined"code into my code
this error message showing
"Closure containing a declaration cannot be used with result builder 'ViewBuilder'"
What I do ?
Post
Replies
Boosts
Views
Activity
Which perfect way to develop this screen ?
https://imgur.com/a/OOKBcfL
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()
}
}
I want Develop setting page for my app and I want someone to do it or help me with it
How I create textfield to select photo in swift?
How I create checkbox in swift ?
Extra arguments at positions #11, #12, #13, #14, #15 in call
HOW CAN I FIX THIS PROPLEM !!