I'm very new to swiftui so I don't know if I'm doing completely wrong but the error is not helpful. Here is my code:
import SwiftUI
struct IntroScreenP2: View {
var hasName: Bool = false
@State private var firstName: String = ""
@State private var lastName: String = ""
var body: some View {
VStack {
if firstName != "" && lastName != "" {
hasName = true
}
TextField("First Name", text: $firstName)
.padding(.leading)
.padding(.bottom, 5)
Divider()
TextField("Last Name", text: $lastName)
.padding(.leading)
.padding(.top, 5)
}
}
}
I'm just trying to set a boolean equal to true when the user enters their name in the text field. It keeps giving me an error saying "Type of expression is ambiguous without more context"