title: How to show/hide the progressHUD, with MVVM and RxSwift in swift
body: <p>I'm beginning with MVVM in order to well separate logic code from the view. But I have some concern about where to put the progressHUD related code when tapping a button that makes a request.</p>
  
  <p>Before, I used to do that:</p>
  
  <pre><code>//Before 
  @IBAction func startRequestTapped() {
     SVProgressHUD.show()
      self.apiClient.requestObservable().subscribe(onError: { (error) in
          SVProgressHUD.hide()                    
      }, onCompleted: { 
          SVProgressHUD.hide()                                        
      })
  }
  </code></pre>
  
  <p>But when I use mvvm, I do like that:</p>
  
  <pre><code>//In the viewModel
  public var validateButtonDidTap = PublishSubject&lt;Void&gt;()
  init() {
      validateButtonDidTap.flatMap { (_)
          return self.apiClient.requestObservable()
      }
  }
  
  
     // In the viewController
  viewDidLoad() {
      let tap = self.validateButton.rx.tap
      tap.bindTo(self.viewModel.validateButtonDidTap)
  }
  </code></pre>
  
  <p>And amongst that, I don't know where to put the the ProgressHUD hide or show.</p>