title: how to use operationqueue to first make API call then second use a URL from that API call?
body: <p>The following code is being used to add dependency using OperationQueues:</p>
  
  <pre><code>    let operationQueue = OperationQueue.main
      let operation1 = BlockOperation(block: {
          self.makeAPICall()
      })
      let operation2 = BlockOperation(block: {
          self.fetchImage(imageURL: modelObject.imageURL)
      })
      operationQueue.addOperation(operation1)
      operationQueue.addOperation(operation2)
      operation2.addDependency(operation1)
  </code></pre>
  
  <p>I'm getting a threading error inside operation2 block. am I missing something. Could you please help. Thank you.  </p>
  
  <blockquote>
    <p>Project was compiled with optimization - stepping may behave oddly; variables may not be available.
    (lldb) bt
    * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
      * frame #0: 0x0000000104df1198 Project<code>ViewController.(viewDidLoad() -&gt; ()).(closure #2) [inlined] function signature specialization &lt;Arg[0] = Owned To Guaranteed&gt; of Project.ViewController.(viewDidLoad () -&gt; ()).(closure #2) at ViewController.swift:61 [opt]
        frame #1: 0x0000000104df1198 Project</code>ViewController.(viewDidLoad() -> ()).(closure #2) at ViewController.swift:60 [opt]
        frame #2: 0x0000000000000008
        frame #3: 0x00000001064b53b7 Foundation`<strong>NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK</strong> + 7</p>
  </blockquote>