title: load data after dispatch_get_global_queue finish
body: <p>well I'm fetching data from internet and this data is similar to be slower </p>
  
  <p>so i have to load it inside dispatch_get_global_queue but on viewDidLoad</p>
  
  <p>but the main problem that if there's collectionView or table it will load while the data is fetching from internet and then collection view for section give me nil , how it's possible to make the collection view load after dispatch_get_global_queue finish</p>
  
  <pre><code>import UIKit
  
  
  class SectionViewController: UIViewController,UICollectionViewDelegate,UICollectionViewDataSource {
      @IBOutlet weak var sectionTab: UIImageView!
      @IBOutlet weak var sectionTitle: UILabel!
      var sectionsPosts:JSON!
      @IBOutlet weak var collectionView: UICollectionView!
      var sectionsTap:JSON!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
                      let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
                      dispatch_async(dispatch_get_global_queue(priority, 0)) {
  
          if Reachability.isConnectedToNetwork() == true {
                  if let url = NSURL(string: "http://nepraswebsite.com/new_lille/mobile_api/blog/first_tab/1") {
                      if let data = try? NSData(contentsOfURL: url, options: []) {
                          self.sectionsTap = JSON(data: data)
                      }
                  }
  
                  if let newurl = NSURL(string: "http://nepraswebsite.com/new_lille/mobile_api/blog/posts_by_category/" + sections[tapIndex]["Slug"].stringValue + "/1") {
                      if let newdata = try? NSData(contentsOfURL: newurl, options: []) {
                          self.sectionsPosts = JSON(data: newdata)
                      }
                  }
                  self.collectionView.reloadData()
  
          }
  
      }
      }
      func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
  
          return sectionsPosts.count
  
      }
  
      func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
  
          let cellA = collectionView.dequeueReusableCellWithReuseIdentifier("postsCell", forIndexPath: indexPath) as! PostsCollectionViewCell
  
  
              cellA.postImage.sd_setImageWithURL(NSURL(string: sectionsPosts[indexPath.row]["Image"].stringValue
                  ), placeholderImage: UIImage(named: "demopic"))
              cellA.postTitle.text = sectionsPosts[indexPath.row]["Title"].stringValue
              return cellA
  
      }
  
          func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
  
              UIApplication.sharedApplication().openURL(NSURL(string: sectionsPosts[indexPath.row]["URL"].stringValue
  )!)
  
  
      }
  
  }
  </code></pre>