Book Image

Swift 2 Design Patterns

By : Julien Lange
Book Image

Swift 2 Design Patterns

By: Julien Lange

Overview of this book

Table of Contents (15 chapters)
Swift 2 Design Patterns
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 5. Behavioral Patterns – Strategy, State, and Template Method

I hope you're still with us; now, we will introduce you to the third and last category of the design patterns, which is categorized as a Gang of Four (GoF) design patterns: the behavioral pattern. Behavioral patterns are dedicated to algorithms and communication between them.

As algorithms consist of several operations that are divided into different classes, behavioral patterns can handle the organization of such classes and the ways in which they can communicate with one another.

The behavioral category contains 11 patterns that we will discuss through four chapters. In this chapter, we will discuss the following three patterns:

  • The strategy pattern

  • The state pattern

  • The template method pattern