Can't disable Writing Tools for SwiftUI TextField

I'm trying to disable Writing Tools for a specific TextField using .writingToolsBehavior(.disabled), but when running the app on my iPhone 16 Pro with Apple Intelligence enabled, I can still use Writing Tools on the text box. I also see no difference with .writingToolsBehavior(.limited).

Is there something I'm doing wrong or is this a bug?

Sample code below:

import SwiftUI

struct ContentView: View {
    @State var text = ""
    var body: some View {
        VStack {
            TextField("Enter Text", text: $text)
                .writingToolsBehavior(.disabled)
        }
        .padding()
    }
}

#Preview {
    ContentView()
}
Answered by Frameworks Engineer in 805508022

Hello @rmahmud28. Sorry you're having trouble with the new API. It's a known issue that TextField and Text currently don't adapt to the writingToolsBehavior(_:) view modifier as documented. It does affect TextEditor, however.

Hello @rmahmud28. Sorry you're having trouble with the new API. It's a known issue that TextField and Text currently don't adapt to the writingToolsBehavior(_:) view modifier as documented. It does affect TextEditor, however.

Feedback ID: FB15281821

This issue continues to be present in iOS 18.1 beta 7. Your documentation says it can be used with TextField, but it doesn't seem to work. Any idea when this will be fixed?

Accepted Answer

Fixed in iOS 18.2 beta 2

Can't disable Writing Tools for SwiftUI TextField
 
 
Q