There are several posts on how to pass a view to a struct using:
struct ContainerView<Content: View>: View {
let content: Content
init(@ViewBuilder content: @escaping () -> Content) {
self.content = content()
}
var body: some View {
content
}
}
But how do you pass a view as a parameter in a function?
2
Answers
You can actually pass a view as a generic:
You also can use AnyView,