Facade Pattern in Swift

Facade means front part of a building. In software world, it is a pattern and represents providing a simpler interface for a complex system which might have many subsystems inside.

A conceptual example might be ordering food in a restaurant. After customer orders food, the staff in the restaurant has many things to do. Customer only cares about ordering food so we should not expose the boring stuff being done on the restaurant side to the customer. Here’s a simple example:

The class Restaurant provides a simple order function for the outside world but inside the function it manages several subsystems(Waiter and Chief) and hides this complexity from the outside.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store