the problem appears to lie with the second parameter you pass to the TextField view builder. You must have a var user somewhere - what kind of object is user, and does it really have a property called user inside it?
I'm using the @State wrapper because it is convenient for state variables which outlive the ContentView itself, but it often isn't useful in a real application. An instance of your User struct will normally live in your data model.
I can get your code to compile if I write the following. Note there is more than one way to put an Int into a TextField.
struct User: Codable {
var firstName: String
var lastName: String
var isAdmin: Bool
var storeNumber: Int
var teamMemberNumber: Int
var userApproved: Bool
var userCreated: Bool
}
struct ContentView: View {
@State private var user = User(firstName: "first", lastName: "lastName", isAdmin: false, storeNumber: 24, teamMemberNumber: 42, userApproved: false, userCreated: false)
var body: some View {
Form {
Section(header: Text("Employee Name")) {
Text(user.firstName)
TextField("First Name", text: $user.firstName)
TextField("Last Name", text: $user.lastName)
}
Section(header: Text("Employee and Store Info")) {
TextField("Store Number", value: $user.storeNumber, formatter: NumberFormatter())
.keyboardType(.numberPad)
TextField("Team Member Number", value: $user.teamMemberNumber, formatter: NumberFormatter())
}
}
}
}
and I can reproduce your error by replacing the last line with this one
TextField("Team Member Number", text: Int($user.user?.teamMemberNumber))
the TextField expect to the text: parameter to be a binding to String, not an Int. Instead of complaining about that, the compiler complains about the Form declaration. The usual initializer for Form is this one
public init(@ViewBuilder content: () -> Content)
while an extension on Form defines this one
public init(_ configuration: FormStyleConfiguration)
The parameter to init which you write after Form might be a View builder, and might be a FormStyleConfiguration. If the expression is malformed, the compiler has to make a guess about what you meant to write, here it guessed wrong, gives you a misleading error message and doesn't point out the real source of the error (the declaration of TextField a text: parameter which is mismatched).
The compiler does keep getting better at pointing out errors. If you file a bug on this Apple might fix it.