I would like my static function to return a bool
as such static func search(email: String?) -> Bool
I tried to do the commented out part but it getting returned as the return value of the closure. How do I get it to return values to the outer calling function search(email: String?)
static func search(email: String?){
HTTPClient().apiQuery(.GET, endpoint: "user.jsn", params: ["user":["email": email!]], handler: {
response in
print(response)
switch response.result {
case .Success(let successJSON):
let successResponse = successJSON as! Dictionary<String, AnyObject>
if let error = successResponse["errors"] {
print(error)
// return false
}
// else { return true }
case .Failure :
print("Failure")
// return false
}
})
}