Book Image

Mastering Swift

By : Jon Hoffman
Book Image

Mastering Swift

By: Jon Hoffman

Overview of this book

Table of Contents (22 chapters)
Mastering Swift
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Behavioral design patterns


Behavioral design patterns explain how objects interact with each other. These patterns describe how different objects send messages to each other to make things happen.

There are nine well-known patterns that are part of the structural design pattern type. They are as follows:

  • Chain of responsibility: This is used to process a variety of requests, each of which may be delegated to a different handler.

  • Command: This creates objects that can encapsulate actions or parameters so that they can be invoked later or by a different component.

  • Iterator: This allows us to access the elements of an object sequentially without exposing the underlying structure.

  • Mediator: This is used to reduce coupling between classes that communicate with each other.

  • Memento: This is used to capture the current state of an object and store it in a manner that can be restored later.

  • Observer: This allows an object to publish changes to its state. Other objects can then subscribe so they can be notified...