Created
June 6, 2019 10:42
-
-
Save Thomvis/dac2327ea253ed2c3ed6bd3dc13a95f2 to your computer and use it in GitHub Desktop.
Thought it would be nice to create a custom stack implementation. Immediately ran into all kinds of walls.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Stack<Item>: View where Item: View { | |
let items: [Item] | |
init(@ViewBuilder items: () -> Item) { | |
fatalError("How to get the views out of the view builder's result (TupleView) into self.items?") | |
} | |
var body: some View { | |
fatalError("How to layout self.items in a Group/ZStack?") | |
return EmptyView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could make your own @_functionBuilder equivalent of ViewBuilder where you can build a type you can peek at. Agree it's a little bogus the way it's all hidden from the outside tho!