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.
Post
Replies
Boosts
Views
Activity
I'd like to build an AppIntent where the parameters are included in the initial invocation.
First-party example "Set a timer for 10 minutes" immediately sets new timer using the parameter 10 minutes.
Is this possible via AppIntents? Or do we have to invoke with "Set a timer" then give parameters via dialog: "for how long"? with user replying "10 minutes."