10162: The SwiftUI cookbook for focus - does not work as expected with iOS 18

I try to create a sheet that shows a textfield and the textfield should gain the focus immediately after the sheet is presented. This use case is explained in Session 10162 at 11:21 and at 13:31 my desired behavior is shown. I could not get this to work in my own code and downloaded the sample code from here:

https://developer.apple.com/documentation/swiftui/focus-cookbook-sample

Then I opened the sample code and run it in the simulator. It does not focus when the sheet appears in a iOS 18 simulator using Xcode 16 installed via the AppStore. It does gain focus if I use the "add" Button.

No changes made on the sample code. Just adjusted the Team setting to get a clean build. The behavior I get locally under iOS 18 is not what is shown in the session and I can't understand why.

I tried the following Simulators (and platforms) iPhone 16, iPad Pro (M4, 11inch) and my Mac. On none of those the last item got focus just by presenting the sheet.

Is it not possible to test this in a simulator? Could I have a configuration error? Given all the information I found yet, this seems like a Bug.

It would be very helpful if someone could replicate my problem. Thank you for your help.

Programm Versions:

Xcode: Version 16.0 (16A242d)
MacOS: 15.0 (24A335)
10162: The SwiftUI cookbook for focus - does not work as expected with iOS 18
 
 
Q