Member-only story
Zip and Zip2Sequence in Swift
What are they, and where should they be used?
2 min readDec 7, 2020
Before we start
Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 12.2, and Swift 5.3
Prerequisites
- You’ll need to either be able to write an iOS application or write some Swift code in Playgrounds
- Some knowledge of Tuple types would be useful for this article
Keywords and Terminology
Tuple: A way in Swift to allow you to store multiple values in a single variable Zip: Creates a sequence of pairs created from two underlying sequences
This article
Background
You may have needed to join two different Arrays into one (same ordered) collection like in the LeetCode 211 constant.
This article explains what is going on!
The simple examples
We can zip up a couple of pairs of Integer Arrays