Wireframe ▸ The view notifies that DidLoad to the Presenter override func viewDidLoad() { self.setupSubviews() self.setupConstraints() self.setNeedsStatusBarAppearanceUpdate() self.presenter?.viewDidLoad() }
▸ Asks the Interactor for Login func userDidSelectLogin() { self.view?.showLoader() self.interactor?.login() { [weak self] (error: NSError?) -> () in if error != nil { // What should we do here? } else { self?.view?.hideLoader() // And here? } } }
to show an error func showError(let errorMessage: String) { ProgressHUD.showError(errorMessage) } If the login success ▸ The Presenter asks the Wireframe to show the home view
thank it ▸ Keep in mind the SOLID principles ▸ Refactor your components through iterations ▸ Decouple your code from the database models and data layers