5 ms·
Actually, it's used pretty heavily by SwiftUI. The DSL for SwiftUI relies pretty heavily on n-element tuples that were previously limited to something like 10 c
by tcldr 3y ago
Actually, it's used pretty heavily by SwiftUI. The DSL for SwiftUI relies pretty heavily on n-element tuples that were previously limited to something like 10 children. So you'd have something like:
VStack {
ViewA()
ViewB()
...
ViewJ()
ViewK() // ERROR: A VStack is limited to 10 elements
}
The only way this could be implemented previously was with a separate init for each possible element count. A lot of auto-generated code.
This eliminates that. So even if you're not implementing it yourself, you're getting the benefits.
- wk_end 3y agoKnowing nothing about Swift or SwiftUI, is there a reason the children of the VStack couldn’t be a list/array?
- happytoexplain 3y agoIt's declarative, i.e. it needs to know what's in the list at IDE time. I can't explain more intelligently than that, though.