Skip to content

Instantly share code, notes, and snippets.

@JadenGeller
Created April 9, 2020 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JadenGeller/9aaa67e6b6f1692cb4c3b0958d2c652c to your computer and use it in GitHub Desktop.
Save JadenGeller/9aaa67e6b6f1692cb4c3b0958d2c652c to your computer and use it in GitHub Desktop.
Grid4x4 SwiftUI View
struct Grid4x4<TopLeft: View, TopRight: View, BottomLeft: View, BottomRight: View>: View {
let topLeft: TopLeft
let topRight: TopRight
let bottomLeft: BottomLeft
let bottomRight: BottomRight
init(@ViewBuilder content: () -> TupleView<(TopLeft, TopRight, BottomLeft, BottomRight)>) {
(topLeft, topRight, bottomLeft, bottomRight) = content().value
}
var body: some View {
VStack {
HStack {
topLeft
topRight
}
HStack {
bottomLeft
bottomRight
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment