Remove all items from array

 Problem

I want to remove all elements from an existing array.



 Recipe


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

// Remove all elements

a.removeAll()

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