re: Looking in to SwiftUI VIEW POST


The some View is a general Swift feature called opaque types. And of course Paul Hudson has a great explanation of it.

The important thing to keep in mind there is that you have to always return the same actual type of View from body. So if you have an if statement inside body, you cannot return, say, a VStack from one branch and a Text from the other. You need to wrap either the if statement in a Group or wrap all your returned views in an AnyView.

Code of Conduct Report abuse