WHAT'S IN THIS CHAPTER?
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
Classes, structs, and enumerations are essential parts of Swift programming. Swift's type system ensures that types are always used in an expected, safe way, minimizing bugs in programs written in the language. While it may seem like this makes code inflexible and tedious to write, it turns out that Swift's type system is so powerful that the opposite is true: Using features of the language, you can easily write flexible code that still takes advantage of the safety offered by Swift.
One of the most visible features of Objective-C was categories. Categories allow Objective-C programmers to “open up” existing classes—including classes they don't control (or even have the source code for)—and to add new methods and properties to those classes. Objective-C's categories were originally conceived as a way to group related methods together in ...