O'Reilly logo

Swift Programming: The Big Nerd Ranch Guide by John Gallagher, Matthew Mathias

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

23 Protocol Extensions

The dominant software design philosophy of the past few decades has been object-oriented programming (OOP). OOP is powerful and well known; people have an intuition for what this style means for code. Traditionally, OOP uses classes to model data and methods to modify the properties on instances of those classes and to communicate with instances of other classes. Swift supports OOP, though its approach to this programming style is nontraditional given that enums and structs can replace many typical uses of classes in OOP.

Swift also addresses some of OOP’s flaws. In OOP, inheritance, in particular, has to be used with great care. It is easy to end up with a code base full of difficult-to-understand classes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required