If you have two sequences that you'd like to join together, the
zip() function will do just that and return an array of tuples. For example:
let names = ["Sophie", "Charlotte", "John"] let scores = [90, 92, 95] let zipped = zip(names, scores)
That will output an array of the tuples ("Sophie", 90), ("Charlotte", 92), and ("John", 95).
SAVE 50% To celebrate Black Friday, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
Link copied to your pasteboard.