Summary

In this chapter, you learned about an object's life cycle. You also learned how object initializers and deinitializers work. We declared our first class to generate a blueprint for objects. We customized object initializers and deinitializers and tested their personalized behavior in action with live examples in Swift's Playground. We understood how they work in combination with automatic reference counting. You also learned how we can run the samples in the Swift REPL and the web-based Swift Sandbox.

Now that you have learned to start creating classes and instances, you are ready to share, protect, use, and hide data with the data encapsulation features included in Swift, which is the topic of the next chapter.

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.