I have the following code:
twitterAPI?.verifyCredentialsWithUserSuccessBlock({ (userName, password) -> Void in
twitterAPI?.getUserTimelin
Try:
twitterAPI?.verifyCredentialsWithUserSuccessBlock({ (userName, password) -> Void in
self.twitterAPI?.getUserTimelineWithScreenName(userName, successBlock: { (objects :[AnyObject]!) -> Void in
}, errorBlock: { (error :NSError!) -> Void in
})
return // <-- ADDED
}, errorBlock: { (error :NSError!) -> Void in
})
In this case
{ (userName, password) -> Void in
self.twitterAPI?.getUserTimelineWithScreenName("", successBlock: { (objects :[AnyObject]!) -> Void in
}, errorBlock: { (error: NSError!) -> Void in
})
}
is a "single expression closure" that has implicit non Void return.
As of Xcode 6.2 / Swift 1.1, you need explicit return here.
Or, use Xcode 6.3 / Swift 1.2 that has fixed this problem.
See this question: One-line closure without return type or Swift - 'Bool' is not a subtype of 'Void'?