In a condensed form, I had the following SwiftUI code:
struct Input {
var someString = "OH HAI"
} struct ContentView : View {
@State private var input = Input()
var body: some View {
TextField("Enter string", text: $input.someString)
.textFieldStyle(.roundedBorder)
.padding()
}
}Then I changed someString to a computed property:
struct Input {
var someString: String {
return "OH HAI"
}
}This results in the following error: "Generic parameter 'Subject' could not be inferred". It took me ten minutes to realize what was the problem: I forgot to add a setter.