.autocorrectionDisabled() not updating with @State variable

Using 'true' or 'false' works as expected and disables Auto Correction:

TextEditor(text: $input)
    .autocorrectionDisabled(true)

But when replacing true with a State variable, only the initial value is used. When the state value changes to 'false', the behavior of autocorrect in the TextEditor doesn't re-enable auto correction.

Here's a simple View to test out:

struct ContentView: View {
    @State var input = ""
    @State var autocorrectionDisabled = true

    var body: some View {

        VStack {
            TextEditor(text: $input)
                .autocorrectionDisabled(autocorrectionDisabled)
                .font(.headline)
         
            Button("Toggle Auto Correction") {
                autocorrectionDisabled.toggle()
                print("autocorrectionDisabled: \(autocorrectionDisabled)")
            }
            .padding()
        }
        .padding()
    }
}

Finally, the value was validated via the print() statement output:

autocorrectionDisabled: false
autocorrectionDisabled: true
autocorrectionDisabled: false
autocorrectionDisabled: true

I'm running this on a physical device with iOS 15 as its our oldest supported target. I'm interested to hear others' results and ideas about how to work around this.

This seems like a bug. I can't get it to work either, and I've tried view extensions, and all manner of other stuff. Raise a feedback report?

Sorry I can't help, but I did try :)

.autocorrectionDisabled() not updating with @State variable
 
 
Q