Preface
Chapter 1: Objects from the Real World to PlaygroundInstalling the required softwareCapturing objects from the real worldGenerating classes to create objectsRecognizing variables and constants to create propertiesRecognizing actions to create methodsOrganizing classes with UML diagramsWorking with API objects in the Xcode PlaygroundExercisesTest your knowledgeSummary
Chapter 2: Structures, Classes, and InstancesUnderstanding structures, classes, and instancesUnderstanding initialization and its customizationUnderstanding deinitialization and its customizationUnderstanding automatic reference countingDeclaring classesCustomizing initializationCustomizing deinitializationCreating the instances of classesExercisesTest your knowledgeSummary
Chapter 3: Encapsulation of Data with PropertiesUnderstanding the elements that compose a classDeclaring stored propertiesGenerating computed properties with setters and gettersCombining setters, getters, and a related propertyUnderstanding property observersTransforming values with setters and gettersUsing type properties to create values shared by all the instances of a classCreating mutable classesBuilding immutable classesExercisesTest your knowledgeSummary
Chapter 4: Inheritance, Abstraction, and SpecializationCreating class hierarchies to abstract and specialize behaviorUnderstanding inheritanceDeclaring classes that inherit from another classOverriding and overloading methodsOverriding propertiesControlling whether subclasses can or cannot override membersWorking with typecasting and polymorphismTaking advantage of operator overloadingDeclaring operator functions for specific subclassesExercisesTest your knowledgeSummary
Chapter 5: Contract Programming with ProtocolsUnderstanding how protocols work in combination with classesDeclaring protocolsDeclaring classes that adopt protocolsTaking advantage of the multiple inheritance of protocolsCombining inheritance and protocolsWorking with methods that receive protocols as argumentsDowncasting with protocols and classesTreating instances of a protocol type as a different subclassSpecifying requirements for propertiesSpecifying requirements for methodsCombining class inheritance with protocol inheritanceExercisesTest your knowledgeSummary
Chapter 6: Maximization of Code Reuse with Generic CodeUnderstanding parametric polymorphism and generic codeDeclaring a protocol to be used as a constraintDeclaring a class that conforms to multiple protocolsDeclaring subclasses that inherit the conformance to protocolsDeclaring a class that works with a constrained generic typeUsing a generic class for multiple typesCombining initializer requirements in protocols with generic typesDeclaring associated types in protocolsCreating shortcuts with subscriptsDeclaring a class that works with two constrained generic typesUsing a generic class with two generic type parametersInheriting and adding associated types in protocolsGeneralizing existing classes with genericsExtending base types to conform to custom protocolsTest your knowledgeExercisesSummary
Chapter 7: Object-Oriented Programming and Functional ProgrammingRefactoring code to take advantage of object-oriented programmingUnderstanding functions as first-class citizensWorking with function types within classesCreating a functional version of array filteringWriting equivalent closures with simplified codeCreating a data repository with generics and protocolsFiltering arrays with complex conditionsUsing map to transform valuesCombining map with reduceChaining filter, map, and reduceSolving algorithms with reduceExercisesTest your knowledgeSummary
Chapter 8: Extendin and Buildin Ob'ect-Oriented CodePutting together all the pieces of the object-oriented puzzleAdding methods with extensionsAdding computed properties to a base type with extensionsDeclaring new convenience initializers with extensionsDefining subscripts with extensionsWorking with object-oriented code in appsAdding an object-oriented data repository to a projectInteracting with an object-oriented data repository throughPicker ViewExercisesTest your knowledgeSummary
Appendix: Exercise AnswersChapter 1, Objects from the Real World to PlaygroundChapter 2, Structures, Classes, and InstancesChapter 3, Encapsulation of Data with PropertiesChapter 4, Inheritance, Abstraction, and SpecializationChapter 5, Contract Programming with ProtocolsChapter 6, Maximization of Code Reuse with Generic CodeChapter 7, Object-Oriented Programming and FunctionalProgrammingChapter 8, Extending and Building Object-Oriented Code
Index