Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MVVMについて.pdf

keisukeYamagishi
November 28, 2021
400

 MVVMについて.pdf

keisukeYamagishi

November 28, 2021
Tweet

Transcript

  1. routeのサンプルコード protocol ViewModelRoute: AnyObject { func detail(_ result: @escaping (Data?,

    String, HTTPURLResponse?, Error?) -> Void) func transition(_ callBack: @escaping () -> Void) }
  2. ViewController側の実装🦾 viewModel.route.detail { [unowned self] data, str, res, error in

    self.detail(data: data, param: str, response: res, error: error) } viewModel.route.transition {[unowned self] in self.detailViewController(isDL: true) } viewModel.ui.progress { percentage in self.progressView.progress = percentage } viewModel.receive.callApi(indexPath)