I'm trying to return JSON from function, for this I do:
func getAllItems() -> JSON {
Alamofire.request(.GET, Links.sharedInstance.getAllItems, encoding: .JSON).validate().responseJSON { (response) in
do {
let json = JSON(data: response.data!)
return json
}
}
}
but it gives me the next error:
Unexpected non-void return value in void function
How can I fix that? I've tried with a local variable inside of func, but in that case I got nil.
Any tips?