Hey, I have just reduced the price for all products. Let's prepare our programming skills for the post-COVID era. Check it out »
Observer

Observer in Swift

Observer is a behavioral design pattern that allows some objects to notify other objects about changes in their state.

The Observer pattern provides a way to subscribe and unsubscribe to and from these events for any object that implements a subscriber interface.

Usage of the pattern in Swift

Complexity:

Popularity:

Usage examples: The Observer pattern is pretty common in Swift code, especially in the GUI components. It provides a way to react to events happening in other objects without coupling to their classes.

Identification: The pattern can be recognized by subscription methods, that store objects in a list and by calls to the update method issued to objects in that list.

Observer in Other Languages

Design Patterns: Observer in Java Design Patterns: Observer in C# Design Patterns: Observer in C++ Design Patterns: Observer in PHP Design Patterns: Observer in Python Design Patterns: Observer in Ruby Design Patterns: Observer in TypeScript Design Patterns: Observer in Go