Design Patterns by Tutorials: Updated for iOS 12 and Swift 4.2!

We’re excited to announce that the second edition of our book Design Patterns by Tutorials is now available — check out what’s been updated in the latest edition! By Chris Belanger.

Save for later

Happy Monday – it’s another iOS 12 Launch Party book release!

Today, we’re happy to announce that the complete digital edition of our Design Patterns by Tutorials, Second Edition book is now available!

This update adds a completely new chapter on the Coordinator Pattern, and also brings the whole book up to the level of Swift 4.2, iOS 12 and Xcode 10.

This will be a free update for existing Design Patterns by Tutorials digital edition customers — our way to say “thanks” to our readers for their support.

Don’t own Design Patterns by Tutorials yet? Read on to see how you can get a copy, and how you can take advantage of our launch discount!

What’s Inside Design Patterns by Tutorials?

Design patterns are reusable, template solutions to common development problems; they’re not concrete implementations, but rather, serve as starting points for writing code. They describe generic solutions to problems that many experienced developers have encountered many times before.

Each chapter offers you a visual diagram of each pattern to make it easy to understand. The authors also give you tips of when to use each pattern and what to watch out for as you develop. And you’ll work through each pattern with step-by-step tutorials to create a real-world app.

Here’s what’s contained in the updated second edition of the book:

Introduction to Design Patterns

This is a high-level introduction to what design patterns are, why they’re important, and how they will help you.

You’ll also learn how to read and use class diagrams in this section. This will make it much easier for you to learn design patterns, so it’s important to go over this first to get the most out of the book.

  • Chapter 1: What Are Design Patterns? Learn this and more in this chapter.
  • Chapter 2: How to Read a Class Diagram: You may have heard of Unified Modeling Language, which is a standard language for creating class diagrams, architectural drawings and other system illustrations. You’ll learn a subset of UML in this chapter that’s useful for creating class diagrams and describing design patterns.

Learn how to read class diagrams — an important skill for learning how design patterns work!

Fundamental Design Patterns

This section covers essential iOS design patterns. These patterns are frequently used throughout iOS development, and every iOS developer should understand these well.

These patterns work well in combinations, so all of the chapters in this section walk you through building a single tutorial project from the ground up.

  • Chapter 3: Model-View-Controller Pattern: The MVC pattern separates objects into three distinct types: models, views and controllers! MVC is very common in iOS programming, because it’s the design pattern that Apple chose to adopt heavily in UIKit. In this chapter you’ll implement the MVC pattern as you build out an app.
  • Chapter 4: Delegation Pattern: The delegation pattern enables an object to use another “helper” object to provide data or perform a task rather than the task itself. You’ll continue building an app from the previous chapter, and add a menu controller to select the group of questions.
  • Chapter 5: Strategy Pattern: The strategy pattern defines a family of interchangeable objects that can be set or switched at runtime: The object using a strategy, the strategy protocol, and the set of strategies. In this chapter, you learn how these three components work together in the strategy pattern.
  • Chapter 6: Singleton Pattern: The singleton pattern restricts a class to only one instance. Every reference to the class refers to the same underlying instance. It is extremely common in iOS app development, because Apple makes extensive use of it, and you’ll learn how to implement it in this chapter.
  • Chapter 7: Memento Pattern: The memento pattern allows an object to be saved and restored. You can use this pattern to implement a save game system. You can also persist an array of mementos, representing a stack of previous states, as well as undo/redo stacks in IDEs. You’ll practice using memento patterns in this chapter.
  • Chapter 8: Observer Pattern: The observer pattern lets one object observe changes on another object. You’ll learn two different ways to implement the observer pattern in this chapter: Using key value observation (KVO), and using an `Observable` wrapper.
  • Chapter 9: Builder Pattern: The builder pattern allows the creation of complex objects step-by-step, instead of all at once, via an initializer.

Learn about each design pattern as you implement it in real-world app scenarios!

Intermediate Design Patterns

This section covers design patterns that are also common, but are used less frequently than the fundamental design patterns in Section II.

Many of these patterns work well together, but not all. You’ll create two projects in this section as you explore these intermediate patterns.

  • Chapter 10: Model-View-ViewModel Pattern: Use this pattern when you need to transform models into another representation for a view. This pattern compliments MVC especially well. You’ll embark on a new project — CoffeeQuest — to help you find the best coffee shops around.
  • Chapter 11: Factory Pattern: The factory pattern provides a way to create objects without exposing creation logic. Technically, there are multiple “flavors” of this pattern, including a simple factory, abstract factory and others. However, each of these share a common goal: to isolate object creation logic within its own construct.
  • Chapter 12: Adapter Pattern: Classes, modules, and functions can’t always be modified, especially if they’re from a third-party library. Sometimes you have to adapt instead! You can create an adapter either by extending an existing class, or creating a new adapter class. This chapter will show you how to do both.
  • Chapter 13: Iterator Pattern: The Iterator Pattern provides a standard way to loop through a collection. Use the iterator pattern when you have a class or struct that holds a group of ordered objects, and you want to make it iterable using a “for in” loop.
  • Chapter 14: Prototype Pattern: Methods are merely functions that reside in a class. In this chapter, you’ll take a closer look at methods and see how to add methods onto classes that were created by someone else.
  • Chapter 15: State Pattern: The state pattern is a behavioral pattern that allows an object to change its behavior at runtime. You’ll see how it does so by changing its current state. “State” here means the set of data that describes how a given object should behave at a given time.
  • Chapter 16: Multicast Delegate Pattern: This is a behavioral pattern that’s a variation on the delegate pattern. It allows you to create one-to-many delegate relationships, instead of one-to-one relationships in a simple delegate. You’ll see how to use this pattern to create one-to-many delegate relationships.
  • Chapter 17: Facade Pattern: The facade pattern is a structural pattern that provides a simple interface to a complex system. See how to use pattern whenever you have a system made up of multiple components and want to provide a simple way for users to perform complex tasks.

Cover beginner to intermediate to advanced design patterns, in the classic tutorial style you’re used to!

Advanced Design Patterns

This section covers design patterns that are very useful but only in rare or specific circumstances. These patterns may be exactly what you need for a particular case, but they may not be useful on every project. However, it’s best to be aware of them as you’ll undoubtedly run across them at some point in your development career.

  • Chapter 18: Flyweight Pattern: This creational design pattern minimizes memory usage and processing. It also provides objects that all share the same underlying data, thus saving memory. Learn about flyweight objects and static methods to return them.
  • Chapter 19: Mediator Pattern: This is a behavioral design pattern that encapsulates how objects, called colleagues for this pattern, communicate with one another. This pattern is useful to separate interactions between colleagues into an object, the mediator. Learn how to use it when you need one or more colleagues to act upon events initiated by another colleague.
  • Chapter 20: Composite Pattern: This is a structural pattern that groups a set of objects into a tree so that they may be manipulated as though they were one object. If your app’s class hierarchy forms a branching pattern, trying to create two types of classes for branches and nodes can make it difficult for those classes to communicate. Learn how to reduce complexity and solve this problem with this pattern.
  • Chapter 21: Command Pattern: This is a behavioral pattern that encapsulates information to perform an action into a command object. Learn how you can model the concept of executing an action and to use this pattern whenever you want to create actions that can be executed on different receivers.
  • Chapter 22: Chain of Responsibility Pattern: This is a behavioral design pattern that allows an event to be processed by one of many handlers. See how to use this pattern whenever you have a group of related objects that handle similar events but vary based on event type, attributes or something else related to the event.
  • Chapter 23: Coordinator Pattern (New!): The coordinator pattern is a structural design pattern for organizing flow logic between view controllers. This pattern can be adopted for only part of an app, or it can be used as an “architectural pattern” to define the structure of an entire app. You’ll see both of these at work in this chapter.

Class diagrams for each chapter make it easy to understand what’s going on.

About the Authors

Meet the well-designed author team behind this book:

Joshua Greene is an author of this book. He is an experienced iOS developer who loves creating elegant apps. When he’s not slinging code, he enjoys martial arts, Netflix and spending time with his wonderful wife and two daughters. You can reach him on Twitter at @jrg_developer.

Jay Strawn is an author of this book. She is a former librarian and is passionate about languages both human and code based. When she’s not working as a developer, Jay enjoys being an ESL conversation partner and reading zines.

Also Available: The iOS 12 Launch Bundle

So many of you have asked for a book bundle to go with the iOS 12 update season, and we’re happy to announce the release of the iOS 12 Launch Party Bundle!

This three-book bundle contains our newest iOS 12 books:

This bundle is on sale for only $99.99 — that’s a savings of 33%! But don’t wait, since this bundle won’t be available forever.

Enter the iOS 12 Launch Party Giveaway

Speaking of sweet deals, be sure to check out the great prizes we’re giving away this year with the iOS 12 Launch Party, including over $9,000 in giveaways!

To be eligible for for this epic iOS 12 giveaway, all you have to do is leave a comment on the original launch post, letting us know which book or course is your favorite on this list — or which upcoming book or course you’re most excited about!

Where to Go From Here?

Design patterns are incredibly useful, no matter what language or platform you develop for.

Not only does Design Patterns by Tutorials cover each pattern in theory, but you’ll also work to incorporate each pattern in a real-world app that’s included with each chapter. Learn by doing, in the step-by-step fashion you’ve come to expect in the other books in our by Tutorials series.

Here’s how to get your hands on a copy:

The book is available for a limited time for just $44.99 as part of our iOS 12 Launch Party celebration. But don’t wait, as this deal won’t be available forever.

We hope you enjoy this update, and stay tuned for a few more updates to come as part of our iOS 12 Launch Party!