Spring SALE

Mediator in Swift

Mediator is a behavioral design pattern that reduces coupling between components of a program by making them communicate indirectly, through a special mediator object.

The Mediator makes it easy to modify, extend and reuse individual components because they’re no longer dependent on the dozens of other classes.



Usage examples: The most popular usage of the Mediator pattern in Swift code is facilitating communications between GUI components of an app. The synonym of the Mediator is the Controller part of MVC pattern.

The following examples are available on Swift Playgrounds.
Kudos to Alejandro Mohamad for creating the Playground version.

Mediator in Other Languages

Mediator in C# Mediator in C++ Mediator in Go Mediator in Java Mediator in PHP Mediator in Python Mediator in Ruby Mediator in Rust Mediator in TypeScript