The previous chapter explained the basic types that form the building blocks of the Swift language. In this chapter, we will build on this knowledge to create more complex structures, such as arrays and dictionaries, before moving on and looking at some of the little gems Swift offers, such as tuples and typealias. Finally, we'll round off this chapter by looking at extensions and access control – both of which are key components that contribute to a sound yet efficient codebase.
In this chapter, we will cover the following recipes:
- Bundling variables into tuples
- Ordering your data with arrays
- Containing your data in sets
- Storing key-value pairs with dictionaries
- Subscripts for custom types
- Changing your name with typealias
- Getting property changing notifications using property observers
- Extending functionality with extensions
- Controlling access with access control
Let's get started!