Summary

In this chapter, you learned about the different members of a class or blueprint. We worked with instance properties, type properties, instance methods, and type methods. We worked with stored properties, getters, setters, and property observers, and we took advantage of access modifiers to hide data.

We worked with superheroes and defined the shared properties of a specific type of lion superhero using type properties. We also worked with mutable and immutable versions of a 3D vector, following the recommendations included in the Swift API Design Guidelines. You also understood the difference between mutable and immutable classes.

Now that you have learned to encapsulate data with properties, you are ready to create class hierarchies to ...

Get Swift 3 ObjectOriented Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.