BLACK FRIDAY SALE: Save 50% on all my Swift books and bundles! >>

Advanced coordinators in iOS tutorial. Few questions to help me understand.

Forums > Swift

Hey guys. I am trying to understand Advanced coordinators in iOS tutorial but to me it feels very incomplete. There are many things that I cannot understand.

The fact that tutorial is being made as seperate chunks that tells you to go back to your original project, makes it hard to connect these elements all together.

Coordinator pattern is quite confusing to me so if anyone could answer on those question (or at least one question!) I would appreciate it:))

Questions are connected directly or no to this tutorial

  1. When creating a coordinator pattern alongisde this tutorial, I've noticed that if you remove var childCoordinators: [Coordinator] { get set } from the whole flow of the app, the application is still working. Flow works as it supposed to. So what is the purpose of that array?
  2. When should we create a ChildCoordinator? Should we create it everytime there is a new VC that have multiple or even single destination? So for each View Controller that may push another View Controller (or may push few different ones depending perhaps on a Buttons) we shoud create a seperate ChildCoordinator? Should those ChildCoordinators interact with superior Child coordinators to them or should they rather interact directly with the Main Coordinator? If that depends, depends on what then?
  3. in "Passing data between view controllers" from the tutorial. Paul asks to reverse the proejct to the original one from the first tutorial about Coordinators. That confuses me as at this point as I am not sure how to connect this part of the tutorial with having child Coordinators. You cannot pass parameter in a function start(). I've just created another method instead and I am not using start() in my child coordinator. My question is, is that a correct way to do so? This is how I did this in another child Coordinator:

    class GoNextCoordinator: Coordinator {
    weak var parentCoordinator: BuyCoordinator?
    var childCoordinators = [Coordinator]()
    var navigationController: UINavigationController
    init(navigationController: UINavigationController) {
        self.navigationController = navigationController
    func start() {
    func pushVC(with parameter: Int) {
        let vc = GoNextVC(parameter: parameter)
        vc.coordinator = self
        navigationController.pushViewController(vc, animated: true)

> 4. it seems like, for someone who is unfamiliar with Coordinator pattern, coordinators create quite complicated flow between each other. Is it really that efficient? Is there any trade off when using them?
> I hope all of it makes sense. If not please dont hesitate replying so I can precise further.


Save 50% in my Black Friday sale.

SAVE 50% To celebrate Black Friday, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.