title: Completion handlers and Operation queues
body: <p>I am trying to do the following approach,</p>
  
  <pre><code>let operationQueue = OperationQueue()
  operationQueue.maxConcurrentOperationCount = 10
  
  func registerUser(completionHandler: @escaping (Result&lt;Data, Error&gt;) -&gt; Void) -&gt; String {
          self.registerClient() { (result) in
          switch result {
              case .success(let data):
                  self.downloadUserProfile(data.profiles)
              case .failure(let error):
                  return self.handleError(error)
          }
      }
    }
  
  func downloadUserProfile(urls: [String]) {
      for url in urls {
          queue.addOperation {
              self.client.downloadTask(with: url)
          }
      }
  }
  </code></pre>
  
  <p>I am checking is there anyway I can get notified when all operations gets completed and then I can call the success handler there.</p>
  
  <p>I tried checking the apple dev documentation which suggests to use         </p>
  
  <pre><code>queue.addBarrierBlock {
     &lt;#code#&gt;
  }
  </code></pre>
  
  <p>but this is available only from iOS 13.0</p>