title: Calling Swift Closure Inside Closure
body: <p>I have the following code: </p>
  
  <pre><code>  twitterAPI?.verifyCredentialsWithUserSuccessBlock({ (userName, password) -&gt; Void in
  
  
              twitterAPI?.getUserTimelineWithScreenName(userName, count: 100, successBlock: { ([AnyObject]!) -&gt; Void in
  
  
  
                  }, errorBlock: { (error :NSError!) -&gt; Void in
  
              })
  
  
  
              }, errorBlock: { (error :NSError!) -&gt; Void in
  
                  println("error block")
          })
  </code></pre>
  
  <p>I am getting the following errors: </p>
  
  <p><img src="https://i.stack.imgur.com/vgUrA.png" alt="enter image description here"></p>
  
  <p>I tried saying self inside the outer closure but it did not work. What am I missing?</p>
  
  <p>UPDATED: Still having build errors: </p>
  
  <p><img src="https://i.stack.imgur.com/DooQT.png" alt="enter image description here"></p>
  
  <p>UPDATE: If I put the getUserTimeline method outside the closure then it works. THIS ONE WORKS. </p>
  
  <pre><code>//        twitterAPI?.getUserTimelineWithScreenName("", successBlock: { (objects :[AnyObject]!) -&gt; Void in
  //            
  //            }, errorBlock: { (error: NSError!) -&gt; Void in
  //        
  //        })
  </code></pre>
  
  <p>But this DOES NOT: </p>
  
  <pre><code>twitterAPI?.verifyCredentialsWithUserSuccessBlock({ (userName, password) -&gt; Void in
  
  
      self.twitterAPI?.getUserTimelineWithScreenName("", successBlock: { (objects :[AnyObject]!) -&gt; Void in
  
          }, errorBlock: { (error: NSError!) -&gt; Void in
  
      })
  
  
  
      }, errorBlock: { (error :NSError!) -&gt; Void in
  
  
  })
  </code></pre>
  
  <p>UPDATE: Definition of getUserTimeLine method </p>
  
  <pre><code>self.twitterAPI?.getUserTimelineWithScreenName(&lt;#screenName: String!#&gt;, successBlock: &lt;#(([AnyObject]!) -&gt; Void)!##([AnyObject]!) -&gt; Void#&gt;, errorBlock: &lt;#((NSError!) -&gt; Void)!##(NSError!) -&gt; Void#&gt;)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/iYVbE.png" alt="enter image description here"></p>
  
  <p>UPDATE: Now, I am getting a build error saying missing argument sinceID. I am not even using that constructor. </p>
  
  <pre><code> if let twitterAPI = self.twitterAPI {
  
              twitterAPI.verifyCredentialsWithUserSuccessBlock({ (userName, password) -&gt; Void in
  
                  twitterAPI.getUserTimelineWithScreenName(userName, successBlock: { (objects :[AnyObject]!) -&gt; Void in
  
                      }, errorBlock: { (error :NSError!) -&gt; Void in
  
                  })
  
  
                  }, errorBlock: { (error :NSError!) -&gt; Void in
  
              })
  
          }
  </code></pre>