The problem I'm trying to solve is quite similar to reimplementing a part of List
.
So for example I have this:
struct MyList<Content: View>: View {
var content: Content
init(@ViewBuilder content: @escaping () -> Content) {
self.content = content()
}
var body: some View {
content
}
}
Here my content can be a Section
, a View
or a TupleView
composed by Section
s or others View
s, or even nested ForEach
s (so others Section
s).
How can I flatMap the content to a simple array of Section
s?