What this book covers
Chapter 1, Objects from the Real World to Playground, teaches you the principles of object-oriented paradigms. We will discuss how real-world objects can become part of the fundamental elements of code. We will translate elements into the different components of the object-oriented paradigm supported in Swift: classes, protocols, properties, methods, and instances.
Chapter 2, Structures, Classes, and Instances, starts generating blueprints to create objects. You will learn about an object's life cycle, and we will work with many examples to understand how object initializers and deinitializers work.
Chapter 3, Encapsulation of Data with Properties, introduces you to organizing data in the blueprints that generate objects. We will understand the different members of a class and how they are reflected by members of the instances generated from a class. You will learn the difference between mutable and immutable classes.
Chapter 4, Inheritance, Abstraction, and Specialization, introduces you to creating a hierarchy of blueprints that generate objects. We will take advantage of inheritance and many related features to specialize behavior.
Chapter 5, Contract Programming with Protocols, discusses how Swift works with protocols in combination with classes. We will declare and combine multiple blueprints to generate a single instance. We will declare protocols with different types of requirements, and then we will create classes that conform to these protocols.
Chapter 6, Maximization of Code Reuse with Generic Code, teaches you how to maximize code reuse by writing code capable of working with objects of different types—that is, instances of classes that conform to specific protocols or whose class hierarchy includes specific superclasses. We will work with protocols and generics.
Chapter 7, Object-Oriented Programming and Functional Programming, teaches you how to refactor existing code to take full advantage of object-oriented code. We will prepare the code for future requirements, reduce maintenance costs, and maximize code reuse. We will also work with many functional programming features included in Swift combined with object-oriented programming.
Chapter 8, Extending and Building Object-Oriented Code, puts together all the pieces of the object-oriented puzzle. We will take advantage of extensions to add features to types, classes, and protocols in which we don't have access to the source code. We will make sure that the code exposes only the things that it has to expose, and you will learn how everything you learned about object-oriented programming is useful in any kind of app we might create.