The zip() function joins two sequences
About 2 min
The zip() function joins two sequences 관련
HACKING WITH SWIFT
What's new in Swift?
The zip() function joins two sequences | Changes in Swift 1.2
The zip() function joins two sequences
Available from Swift 1.2
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).
Other changes in Swift 1.2…
The flatMap() method transforms optionals and arrays | Changes in Swift 1.2
The flatMap() method transforms optionals and arrays
Closures can now be marked @noescape | Changes in Swift 1.2
Closures can now be marked @noescape
Classes can now have static methods and properties | Changes in Swift 1.2
Classes can now have static methods and properties
Constants no longer require immediate initialization | Changes in Swift 1.2
Constants no longer require immediate initialization
A new Set data structure | Changes in Swift 1.2
A new Set data structure
Implicit bridging has been reduced | Changes in Swift 1.2
Implicit bridging has been reduced
Multiple if let bindings | Changes in Swift 1.2
Multiple if let bindings
Typecasting now includes as! | Changes in Swift 1.2
Typecasting now includes as!