Scene Coordinator and BindableType View Controllers Question

In chapter 24 a scene coordinator is used, which I really like the idea of in MVVM. My question is “Do all view controllers need to have a UINavigationController sitting in front of it?”

I ask this, because when I try to segue to another view controller (that does not have it’s own nav controller) I have issues with the mutating bindViewModel that should accept the View Model. I receive the error Argument passed to call that takes no arguments when calling vc.bindViewModel(to: viewModel)

    case .purchaseOrderList(let viewModel):
      let vc = storyboard.instantiateViewController(withIdentifier: "PurchaseOrderList") as! PurchaseOrderListViewController
//      var vc = nc.viewControllers.first as! PurchaseOrderListViewController
      vc.bindViewModel(to: viewModel) // <--- ERROR: Argument passed to call that takes no arguments

I believe I’ve answered the question for the most part. The odd error was because I defined vc as immutable with let. Changing that to a mutable var resolved the issue. Just a bad error message.

This topic was automatically closed after 166 days. New replies are no longer allowed.