title: How to change protocol to typealias or closure
body: <p>In my code I do not want to use protocol I want use closures but I couldn't get it done because I am new on Swift. </p>
  
  <p>Here is the example of class </p>
  
  <pre><code>class SplashPresenterImp: SplashPresenter, OnFinishedListener {
  
      private var interactor: SplashInteractor
      private var splashNetworkProtocol: SplashNetworkProtocol
  
  
      init() {
          interactor = SplashNetworking()
      }
  
      func startDownloadConfigs(splashNetworkProtocol: SplashNetworkProtocol){
          if  interactor != nil {
              interactor.loadConfigs(listener: self)
              self.splashNetworkProtocol = splashNetworkProtocol
          }
      }
  
      func startDownloadDictionary(splashNetworkProtocol: SplashNetworkProtocol) {
          if  interactor != nil {
              interactor.loadDictionary(listener: self)
              self.splashNetworkProtocol = splashNetworkProtocol
          }
      }
  
      func onFinishedGetDictionary(dictionary: Dictionary) {
          //save dictionary
          if splashNetworkProtocol != nil {
              splashNetworkProtocol.onSuccess()
          }
      }
      func onFinishedGetConfigs(config: Config) {
          //save configs
          if splashNetworkProtocol != nil {
              splashNetworkProtocol.onSuccess()
          }
      }
      func onFinishedWithError(error: AMError) {
          if splashNetworkProtocol != nil {
              splashNetworkProtocol.onError(error: error)()
          }
      }
  
  }
  </code></pre>
  
  <p>Here is the protocol</p>
  
  <pre><code>protocol SplashNetworkProtocol: class {
      func onSuccess()
      func onError(error: AMError)
  }
  </code></pre>
  
  <p>What I want to have on my viewcontroller to have closure when downloadConfig is complete to start downloadDictionary. </p>
  
  <p>I know how it handle on Java here is the code</p>
  
  <pre><code>mPresenter.startDownloadConfigs(new SplashNetworkProtocol() {
              @Override
              public void onSuccess() {
                  downloadDictionary();
              }
  
              @Override
              public void onError(final AMError error) {
  
              }
          });
  </code></pre>
  
  <p>I want to have same result in swift. Is anyone can give me advice how to do this? </p>
  
  <p>More clearly I want get rid of <code>SplashNetworkProtocol</code> and use only closure.</p>
  
  <p>swift result should be this </p>
  
  <pre><code>mPresenter.startDownloadConfigs(onSuccess: {} onError{}
  </code></pre>