Member-only story

How to Pass Data between View Controllers Like a Pro

Brahim Siempay
4 min readFeb 17, 2023

--

Photo by Lochie Blanch on Unsplash

Passing data between view controllers is a crucial aspect of building iOS applications. There are several ways to achieve this, such as using delegates, closures, or notifications. However, these approaches can become complex and hard to maintain when dealing with multiple view controllers and data sources.

In this article, we will discuss how to use the coordinator pattern to pass data between view controllers. The coordinator pattern is a design pattern that helps in managing the flow of an application by decoupling view controllers from each other and centralizing the navigation logic.

We will start by defining what the coordinator pattern is, and then we will demonstrate how it can be used to pass data between view controllers. Finally, we will highlight the benefits of using this approach in building iOS applications.

What is the Coordinator Pattern?

The coordinator pattern is a design pattern that helps in managing the flow of an application by decoupling view controllers from each other and centralizing the navigation logic. The coordinator acts as a mediator between the view controllers, providing a layer of abstraction to handle the transitions and data passing between them.

--

--

Brahim Siempay
Brahim Siempay

No responses yet