Design patterns

We will go through a quick inventory of common design patterns that are used most extensively while working with iOS apps. The first design pattern we will look at is the two stage Object creation; it divides the process into separate memory allocation and initialization steps. This might appear cumbersome, but as we will see later, it allows greater flexibility in how we customize initialization methods. This facilitates code reuse both within classes and between classes in the inheritance hierarchy; then we will look at Singletons.

The Singleton pattern encapsulates a shared resource within a single unique class instance. This instance arbitrates access to the resource and storage-related state information. A class method ...

Get Reactive Programming with Swift 4 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.