Home > Back-end >  How can I zip 4 arrays in Swift?
How can I zip 4 arrays in Swift?

Time:04-11

zip(a, zip(b, c)).map { ($0, $1.0, $1.1) } Here three are being done but I need to zip four arrays.

CodePudding user response:

Maybe not the prettiest, but it works:

zip(a, zip(b, zip(c, d))).map { ($0, $1.0, $1.1.0, $1.1.1) }
  • Related