SwiftUI Textfield Error

Hi!

I noticed that when I use the simple Textfield in SwiftUI it generates unexpected error:

-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID

Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem.

If you want to see the backtrace, please set CG_NUMERICS_SHOW_BACKTRACE environmental variable.

Here is the code example to repoduce the error:


import SwiftUI

struct ContentView: View {

    @State private var firstName = ""

    var body: some View {
        
            TextField("First name", text: $firstName)

    }
}

How it could be fixed ? Is it one of the bugs that came along with iOS 17 ?

Thank you!

The warning you get does not stop app from working.

You can ignore the message (even though it is disturbing): https://stackoverflow.com/questions/76399775/error-invalid-numeric-value-nan-or-not-a-number-to-coregraphics-api-possib

Looks like a bug in SwiftUI : https://developer.apple.com/forums/thread/738726

I have tried to define a frame for the TextField to no avail.

I toggled twice Software keyboard in I/O menu of simulator and that apparently silenced the error… So it could be that the issue comes from the software keyboard in simulator (I also got another error, saying that it could not "move our portal view at the top". Seems to confirm keyboard bug in simulator.

SwiftUI Textfield Error
 
 
Q