Got a tip from @danielsaidi and @babbage to try running my crashing TestFlight app in release mode (which I've never done before).
It immediately told me that child View IDs must be unique.
I stopped it with this .id line. Still not sure why this works just fine in debug mode. 🤔
[#]SwiftUI
=> More informations about this toot | More toots from MuseumShuffle@mastodon.social
@MuseumShuffle @danielsaidi @babbage Wild guess - but could it be related to views being erased to AnyView in debug mode? You could set the compilation flag SWIFT_ENABLE_OPAQUE_TYPE_ERASURE=NO and check if it crashes in debug mode as well after that change.
=> More informations about this toot | More toots from vincefried@mastodon.social
@vincefried @MuseumShuffle @danielsaidi yes that was my theory of the cause of the issue too.
=> More informations about this toot | More toots from babbage@iosdev.space
@babbage @vincefried @MuseumShuffle In comb with iterating over the same date format collection for each display choice, the IDs must then conflict
=> More informations about this toot | More toots from danielsaidi@mastodon.social
@danielsaidi @babbage @vincefried Looks like y'all were right! When I set that flag to NO debug acts just like release did in that it stops and tells me the error about child Views.
=> More informations about this toot | More toots from MuseumShuffle@mastodon.social
@MuseumShuffle @danielsaidi @vincefried I think this AnyView wrapper kludge Apple added to make SwiftUI previews more “reliable” has proven to be a terrible decision. The last thing we need is behavior that varies between debug and release builds like this. I have that flag set to disable it permanently. I’m guessing they will revert it in the next major Xcode release.
=> More informations about this toot | More toots from babbage@iosdev.space
@babbage @MuseumShuffle @danielsaidi 100% agreed. It’s the reason why I listed it as one of the common pitfalls in my recent article.
https://swift.vincentfriedrich.com/posts/common-swiftui-pitfalls/
Btw the Xcode 16.2 release notes mention the topic and that it has been added for better preview performance as well as „Xcode 16.2 adds experimental support for disabling the build setting while retaining preview usage, though preview performance will degrade significantly. (138952991)“
=> More informations about this toot | More toots from vincefried@mastodon.social This content has been proxied by September (3851b).Proxy Information
text/gemini