🎉 Hooray! After 3 years of work, I've finally released the ebook on design patterns! Check it out »
Bridge

Bridge in Swift

Bridge is a structural design pattern that divides business logic or huge class into separate class hierarchies that can be developed independently.

One of these hierarchies (often called the Abstraction) will get a reference to an object of the second hierarchy (Implementation). The abstraction will be able to delegate some (sometimes, most) of its calls to the implementations object. Since all implementations will have a common interface, they’d be interchangeable inside the abstraction.

Learn more about Bridge

Usage of the pattern in Swift

Complexity:

Popularity:

Usage examples: The Bridge pattern is especially useful when dealing with cross-platform apps, supporting multiple types of database servers or working with several API providers of a certain kind (for example, cloud platforms, social networks, etc.)

Identification: Bridge can be recognized by a clear distinction between some controlling entity and several different platforms that it relies on.

Bridge in Other Languages

Design Patterns: Bridge in Java Design Patterns: Bridge in C# Design Patterns: Bridge in PHP Design Patterns: Bridge in Python Design Patterns: Bridge in Ruby Design Patterns: Bridge in TypeScript