title: How to dismiss viewController in ios using Swift
body: <p>I have a viewController which contains only an imageview. I want to present it whenever there is a loading in the application like fetching data from a webservice. So I have created a function in my loaderViewController as </p>
  
  <pre><code>func showLoading(viewController:UIViewController) {
      viewController.presentViewController(LoadingViewController(), animated: false, completion: nil)
  }
  </code></pre>
  
  <p>This is working as expected, when I call this function when desired like below</p>
  
  <pre><code>var loader = LoadingViewController()
  loader.showLoading(self)
  </code></pre>
  
  <p>It show me the viewController with image.</p>
  
  <p>But Now  want to dismiss this viewController when desired but I am not able to do so, This is what I have tried so far, I created another function in my LoaderViewController as </p>
  
  <pre><code>func dismissLoader() {
      let load = LoadingViewController()
      load.dismissViewControllerAnimated(true) {
          print("Dismissing Loader view Controller")
      }
  }
  </code></pre>
  
  <p>But its not working and the viewController is not disappering from the screen. </p>
  
  <p>Please guide me</p>