Elektrine lite

← Feed

@willing@mastodon.social

Post #2853770

2025-08-05 15:09 UTC

@axiixc I enjoyed your recent SwiftUI wish list post! Nobody discusses container lifetime and it’s a very meaningful problem for those of us that are pushing SwiftUI beyond the basics. I was hoping that the ContainerValues API (or the variadic API before it) would offer us more control over lifetime, but sadly it does not. When using it as a navigation stack, it keeps the state of the top-level View, but any subview state is lost — along with any scroll position (Apple folks: FB16459615).

Replies (1)

  • @axiixc@social.axiixc.com 2025-08-05 19:15

    @willing@mastodon.social yeah, all the subview-y APIs have been great additions, still totally separate axis of functionality though. UIHostingController can get you pretty far! Just look out for sharp edges. I never took that far enough to have a general list of issues. I think the things I recall are mostly state inconsistencies and environment/preference weirdness. In theory, now that we have Environment ↔ UITraitCollection bridging, I think it should be better than ever though.

    Open ##4029242