May be I missed something of your intent.
Why using a Binding here ? That means ContentView is called from another view with a Sate var ?
Otherwise, it is a misuse of Binding.
I changed to this, which works.
struct ContentView: View {
@State var boundValue: Double?
@State private var stateValue: Double? = 55
var body: some View {
CallTextField(boundValue: $boundValue)
// TextField("Bound value", value: $boundValue, format: .number)
Text("\(boundValue ?? .nan)")
TextField("State value", value: $stateValue, format: .number)
Text("\(stateValue ?? .nan)")
}
}
struct CallTextField: View {
@Binding var boundValue: Double?
var body: some View {
TextField("Bound value", value: $boundValue, format: .number)
}
}