Hacker News new | ask | show | jobs
by tcldr 832 days 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.

1 comments

Knowing nothing about Swift or SwiftUI, is there a reason the children of the VStack couldn’t be a list/array?
It'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.