Unable to enter text in TextField - SwiftUI preview

I'm trying out Xcode 12 (beta) and encountered an issue with TextField when viewing it in a live Preview.

Although the view is interactive (scrolling vertically seems to be OK) and a cursor appears in the TextField view when it is clicked on, keyboard input is ignored.

The same code works as expected in Xcode 11.5. Simulator in both 11.5 and 12 exhibits expected behaviour.

Is this a bug? I know there is an issue with interactivity in Preview with multiple views inside PreviewProvider but I'd assumed this is if you'd added multiple Views to the same body of this struct.


  • Same issue with Xcode 13.2.1, I downloaded from the Application Store, I downloaded from the Developers website, the same error, I cannot enter info on a TextField in Preview, the cursor appear, I can paste, but not enter data from the keyboard. I can enter data when I run the sample in my phone.

  • I'm trying to get my head around Xcode Swift 5. It really doesn't help with understanding or confidence when the software tool itself is not being maintained well enough for what has evidently been a long standing bug to still exist as of January 26 2022. I'm using an M1 Macbook pro and fully up to date

    OS Monterey Version 12.1 (21C52) with Xcode Version 13.2.1 (13C100)

Add a Comment

Replies

Howdy,

I'm sorry to hear you are having problems with interactive previews. As you've noticed, there is a currently known issue with keyboard input during an interactive preview session. We are working on a fix to this.
Thanks for the confirmation. I'll use the sim for now :-)

Has this been resolved?

Same issue in Xcode 13.0 (13A233)

Same issue in Version 13.2 (13C90). I was able to type in the live preview on a new project until I ran it in the sim for the first time. Now I'm not able to type in live previews. I tried cleaning the build folder, restarting the sim, switching sims, and restarting Xcode.

  • Same here. Also, if there seems to be an invisible iOS keyboard when focused on the text field that you can interact with.

  • Can confirm for 13.2, same issue here: can't type on actual keyboard but a hidden keyboard is there at the bottom of the preview which you can interact with, but can't actually see.

  • This is definitely a bug in 13.2 specifically. I tried the solution posted by macrojd below which was to downgrade to 13.1. Annoying, especially with the size of Xcode. Xcode devs take note, and update your test suites!

Add a Comment

I have the same problem in Xcode 13.2. The only solution was to uninstall the 13.2 version and install the 13.1 version again. Very annoying.

  • This is an old issue for Xcode. 12, maybe we should make a new one so the devs notice quicker for 13.2 specifically?

Add a Comment

I am facing the same issue in Xcode Version 13.2.1 (13C100). I cannot type in the preview, and even the keyboard isn't visible, but for the simulator, at least I can type in. It would be great if it is fixed it ASAP!

Same here, everyone. This is a new frustration for me so hoping it gets resolved soon.

Ugh - reported over a year ago with Xcode 12, apparently fixed in Xcode 13.1, re-introduced in 13.2.1. So much for regression testing?

I am having this issue as well. It is hindering my progress. Please create a fix for this.

13.2.1 (13C100)

I am having this same issue. I cannot even type in any character by using my own keyboard to the text field while it is in preview mode.

Xcode 13.2.1 (13C100)

The same here with Xcode 13.2.1. Please take care of this - it is a serious impediment!

Also experiencing this issue with Xcode 13.2.1 on an M1 Pro Macbook Pro.

the same problem M1 Macbook Pro

The same issue. Xcode 13.2.1 (13C100)