Map an array to another array


I have an array and want to map its values to a different array, based on a given transformation.


// Initialize the Array
var a = [1,2,3,4,5,6]

// Map values to their doubles: 1->2, 2->4, etc.

var b = { $0 * 2 }

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)