Friend spotlight!
Whimsical Animations course
Friend spotlight!
NEW Whimsical Animations course
Friend spotlight! NEW Whimsical Animations course
huge discount only this week
Friend spotlight! Want to make your project stand out? NEW Whimsical Animations course huge discount only this week
Mediator

Mediator を Swift で

Mediator 振る舞いに関するデザインパターンの一つで プログラムのコンポーネント間の通信を特別なメディエーター・オブジェクトを通して行うことで 結合を疎にします

Mediator により 個々のコンポーネントは 何十ものクラスへの依存がなくなるため 変更 拡張 再利用が容易になります

複雑度

人気度

使用例 Swift コードで Mediator パターンがよく使われるのは アプリの GUI コンポーネント間の通信のやりとりです Mediator は MVC パターンの C の部分 Controller と同義語です

以下の例は Swift Playgroundsで利用できます。
Playgroundバージョンを作成してくれた Alejandro Mohamadに感謝します。

他言語での Mediator

Mediator を C# で Mediator を C++ で Mediator を Go で Mediator を Java で Mediator を PHP で Mediator を Python で Mediator を Ruby で Mediator を Rust で Mediator を TypeScript で