It worked after downgrading Xcode to 16.2.
https://stackoverflow.com/questions/79573379/after-upgrading-from-xcode-14-0-to-xcode-16-3-my-swiftui-project-failed-to-run?noredirect=1#comment140333399_79573379
Topic:
Developer Tools & Services
SubTopic:
Xcode