title: Synchronization of 3 threads in Swift 4
body: <p>I have 3 threads to download data from the internet.</p>
  
  <pre><code>func thread1() {
      DispatchQueue.global().async {
          // do something from json
      }
  }
  
  func thread2() {
      DispatchQueue.global().async {
          // do something from json
      }
  }
  
  func thread3() {
      DispatchQueue.global().async {
          // download img
      }
  }
  
  
  func finishFunction() {
      print("Finish")
  }
  </code></pre>
  
  <p>I would like to start the finishFunction function after finishing threads 1, 2 and 3. How can this be done?</p>