WHAT YOU WILL LEARN IN THIS CHAPTER:
Swift provides two types of collections for storing data of the same type: arrays and dictionaries. An array stores its items in an ordered fashion, whereas a dictionary stores its items in an unordered fashion and uses a unique key to identify each item.
In Swift, both the array and the dictionary are very clear about the type of data they are storing. Unlike the
NSDictionary classes in Objective-C, arrays and dictionaries in Swift use either type inference or explicit type declaration to ensure that only specific types of data can be stored. This strict rule about data types enables developers to write type-safe code.
An array is an indexed collection of objects. The following statement shows an array containing three items:
var OSes = ["iOS", ...