SwiftUI textfield no longer editable

I created project with Xcode 14.3. Then I upgraded to 14.3.1, Xcode would not start. I downgraded to 14.3 same issue Xcode would not start. Then downgraded to 14.2 Xcode started. But now I cannot edit the Textfield in any of the views in side the old project. I try to highlight the textfield, it shows a paste icon and allows me to paste whatever is in buffer from previous copy command. But it will not allow me to edit and enter data. In fact none of the Textfields in any of the views are editable.

How to fix this please?

My code below:

struct AddContactView: View {
    @Environment(\.managedObjectContext) private var viewContext
    @Environment(\.dismiss) var dismiss
    
    @State private var fNameInput: String = ""
    @State private var lNameInput: String = ""
    @State private var phoneInput: String = ""
    @State private var emailInput: String = ""
    @State private var screenNameInput: String = ""
    @State private var consumerTypeInput: String = ""
    @State private var defaultUserRating: String = "*****"
    
    @State private var isShowPhotoLibrary = false
    @State private var image = UIImage()
    @State private var selectedPhoto: PhotosPickerItem?
    @State private var selectedPhotoData: Data?
  
    
    @Environment(\.presentationMode) var presentationMode
var body: some View {

        VStack (alignment: .leading){

            Form {
                TextField("Full Name", text: $fNameInput)
                    .textContentType(.name)
                    .keyboardType(.alphabet)
                TextField("Last Name", text: $lNameInput)
                    .textContentType(.name)
                    .keyboardType(.alphabet)
                TextField("Phone Number", text: $phoneInput)
                    .textContentType(.telephoneNumber)
                    .keyboardType(.numberPad)
                TextField("Email", text: $emailInput)
                    .textContentType(.emailAddress)
                    .keyboardType(.alphabet)
                TextField("Consumer Type", text: $consumerTypeInput)
                    .textContentType(.name)
                    .textContentType(.name)
                    .keyboardType(.alphabet)
            }
            Spacer()
        }
        .padding()
        .navigationTitle("Add Contact")
    .toolbar {
  
        ToolbarItem(placement: .navigationBarLeading) {
            Button(action: {  presentationMode.wrappedValue.dismiss() }, label: {
                HStack(spacing: 2) {
                    Image(systemName: "chevron.backward")
                        .foregroundColor(.black)

                    Button("Back", action: {
                        self.presentationMode.wrappedValue.dismiss()
                    } )
                    .foregroundColor(.black)
                }
            })
        }
        
    }
    .navigationBarBackButtonHidden(true)
}

}

View:

Replies

I would first try the usual tricks:

  • Clean Build folder
  • delete all derived data
  • then close Xcode and restart…

Is it in simulator ?

What happens when you tap in a TextField (do you get the paste menu ?)

Yes happens in Simulator. I cleaned build folder, deleted the derived data, and restarted Xcode. Same issue cannot edit Textfield. Double clicking on Textfield, the Paste menu comes up and it pastes the previous text from copied buffer. Did going back to 14.2 from 14.3 mess it up?