Chapter    22

The Observer Pattern

The observer pattern is used to manage the process by which one object expresses interest in—and receives notification of—changes in another. The observer pattern allows large and complex groups of objects to cooperate with one another with few dependencies between them and is so widely used that you are likely to have come across it if you have developed an application using a modern UI component framework. Table 22-1 puts the observer pattern in context.

Table 22-1. Putting the Observer Pattern into Context



What is it?

The observer pattern allows one object to register to receive notifications about changes in another object without needing to depend on the implementation of that object.

What ...

Get Pro Design Patterns in Swift now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.