4 Comments
User's avatar
Alex Simpson's avatar

How does this compare to iOS 18's container view APIs? I thought that was the modern replacement for using _VariadicView, but not sure

Expand full comment
Omar Elsayed's avatar

don't quite understand your question, can you elaborate more ?

Expand full comment
Alex Simpson's avatar

The new container APIs for SwiftUI in iOS 18 seem to be a non-private, intentional replacement for _VariadicView. I keep seeing these posts but no-one mentioning these new APIs.

https://medium.com/snapp-mobile/deep-dive-into-swiftui-containers-key-takeaways-from-wwdc24-99e08a40e80c

Expand full comment
Omar Elsayed's avatar

Now I got you, first there is no replacement for the _VariadicView it's the core of all the swiftUI containers like HStack, etc. For the new api you are talking about which is mentioned and explained better in this session https://developer.apple.com/videos/play/wwdc2024/10146, is basically a way to create a data driven list container which have an init seemlier to the ForEach for example.

This doesn't mean it replaces _VariadicView because of two things, first to use it you need to support iOS 18 and secondly there are some use cases like the one in the article that doesn't need to use the new api but rather the _VariadicView is a better choose for it.

Expand full comment