title: How to show activity indicator while tableView loads?
body: <p>When I switch between my tabs it loads some seconds and I want to know that my data is loading. For that I decided to add an activity indicator.</p>
  
  <p>I wrote a little function:</p>
  
  <pre><code>func showActivityIndicator() {
      dispatch_async(dispatch_get_main_queue()) {
          self.spinner = UIActivityIndicatorView(activityIndicatorStyle: .WhiteLarge)
          self.spinner.frame = CGRect(x: 0.0, y: 0.0, width: 80.0, height: 80.0)
          self.spinner.center = CGPoint(x:self.loadingView.bounds.size.width / 2, y:self.loadingView.bounds.size.height / 2)
  
          self.loadingView.addSubview(self.spinner)
          self.view.addSubview(self.loadingView)
          self.spinner.startAnimating()
      }
  }
  </code></pre>
  
  <p>that will show my indicator. And try to use it when I tapped from my infoController to button:</p>
  
  <pre><code>@IBAction func goToMainFromInfo(sender: AnyObject) {
          self.showActivityIndicator()
          self.performSegueWithIdentifier("fromMainToInfoWActivity", sender: nil)
          self.hideActivityIndicator()
      }
  }
  </code></pre>
  
  <p>I show it before segue perform and hide after. It doesn't help me. When I did try to use sync:</p>
  
  <pre><code>@IBAction func goToMainFromInfo(sender: AnyObject) {
      dispatch_async(dispatch_get_main_queue()) {
          self.showActivityIndicator()
          self.performSegueWithIdentifier("fromMainToInfoWActivity", sender: nil)
          self.hideActivityIndicator()
      }
  }
  </code></pre>
  
  <p>But it doesn't help too. When I press to tab it opacity becomes 0.5 and I wait while it loading. But I do not see my activity indicator. </p>
  
  <p>What is the problem?</p>