'How can I zip 4 arrays in Swift?

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



Solution 1:[1]

Maybe not the prettiest, but it works:

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alexander Sandberg