Reverse an array

 Problem

I have an Array and want to reverse it (reverse the order of its contents).



 Recipe


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

// Reverse its contents

a = a.reverse()
print(a)
				

Heard the news?

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

 

 Playground