Ancestors

Written by Chris Wu :toucan: on 2025-01-25 at 23:01

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

=> View attached media

=> More informations about this toot | More toots from MuseumShuffle@mastodon.social

Written by Vincent Friedrich on 2025-01-26 at 08:16

@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

Written by Duncan Babbage on 2025-01-26 at 08:25

@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

Written by Daniel Saidi on 2025-01-26 at 08:28

@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

Toot

Written by Chris Wu :toucan: on 2025-01-26 at 21:27

@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

Descendants

Written by Duncan Babbage on 2025-01-26 at 21:29

@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

Written by Vincent Friedrich on 2025-01-26 at 23:16

@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

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113896773605647823
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
305.198134 milliseconds
Gemini-to-HTML Time
1.034611 milliseconds

This content has been proxied by September (3851b).