Member-only story

Zip and Zip2Sequence in Swift

What are they, and where should they be used?

Steven Curtis
2 min readDec 7, 2020
Photo by Jan Meeus @janmeeus

Before we start

Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 12.2, and Swift 5.3

Prerequisites

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

--

--

No responses yet