Ordering your data with arrays
In this chapter, and the last, we were introduced to many different Swift constructs: classes, structs, enums, closures, protocols, and tuples. Yet, rarely will we be dealing with these on their own; we will likely have many instances of these constructs, and we need a way to collect multiple instances in useful data structures. We will examine three collection data structures provided by Swift: arrays, sets, and Dictionaries (often called hash tables in other languages):

In the next few recipes, we'll look at how to use them to store and access elements, and examine their relative characteristics.
How to do it...
First, let's investigate arrays, which are an ordered list of elements. Enter the following into a new playground to see how we can create arrays and manipulate the elements in them:
var moviesToWatch: Array<String> = Array() moviesToWatch.append("The Shawshank Redemption") moviesToWatch.append("Ghostbusters") moviesToWatch.append("Terminator...