I'm familiar with having them with an alamofire function usually after the .response or . responseJSON like in this post or like so:
func checkInLocation (accessToken: String, id: Int, latitude: Double, radius: Double, longitude: Double, completionHandler: String) {
let headers = [
"Authorization": "bearer \(accessToken)",
"Cache-Control": "no-cache",
"Content-Type": "application/json"
]
let parameters: [String: AnyObject] = [
"id" : id,
"latitude": latitude,
"radius": radius,
"longitude":longitude,
"languageCulture": "en"
]
Alamofire.request(.POST, "\(baseApiUrl)members/\(id)/checkin", parameters: parameters, encoding: .JSON, headers: headers)
.responseJSON(completionHandler: { response in
if((response.result.value) != nil) {
let swiftyJsonVar = JSON(response.result.value!)
print("This is the checkin response:\(swiftyJsonVar)")
}
})
}
I'm trying to get it from the call to the function like so:
checkInLocation(userInfo.sharedInstance.getAccessToken(), id: userInfo.sharedInstance.getMemberID()!, latitude: currentUserLatitude!, radius: 0.3, longitude: currentUserLongitude!, completionHandler: {
//get JSON response data here
})