Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Swift 2 Design Patterns

You're reading from   Swift 2 Design Patterns Build robust and scalable iOS and Mac OS X game applications

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781785887611
Length 224 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
 Lange Lange
Author Profile Icon Lange
Lange
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Swift 2 Design Patterns
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Creational Patterns FREE CHAPTER 2. Structural Patterns – Decorator, Proxy, and Bridge 3. Structural Patterns – Composite and Flyweight 4. Structural Patterns – Adapter and Facade 5. Behavioral Patterns – Strategy, State, and Template Method 6. Behavioral Patterns – Chain of Responsibility and Command 7. Behavioral Patterns – Iterator, Mediator, and Observer 8. Behavioral Patterns – Visitor, Interpreter, and Memento Index

The chain of responsibility pattern


When you write an application, it may be that an event generated by an object needs to be handled by another object. You may also want the handle to be inaccessible by another object.

Roles

In this section, you will notice that the chain of responsibility pattern creates a chain of objects in such a way that if an object of this chain cannot handle the request, it sends the request to the next object, the successor, until one of them can handle the request.

This pattern allows an object to send a request without knowing which object will receive and handle it. The request is sent from one object to another, making them parts of a chain. Each object of this chain can handle the request, pass it to its successor, or do both.

You may want to use this pattern when:

  • You want to decouple the sender of a request to its receiver, allowing other objects to handle the request too

  • Objects that can handle the request are part of a chain of work, the request passes from...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images