Last active
November 21, 2015 01:33
-
-
Save dinkengraven/e35140bc138f56dde972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// here is the call to my Rails server. It works just fine and returns the data that I would expect. Line 17 | |
// returns the following dictionary from a nested JSON object: | |
// ["long": 234.232, "lat": 14.023, "updated_at": 2015-11-20T18:23:37.649Z, "identifier": Some string, | |
// "created_at": 2015-11-20T18:23:37.649Z, "message": Some message, "id": 1] | |
// The problem is that I don't understand how to do anything with the JSON data other than print it. I need to | |
// make a breadcrumb object with the data returned from the server. | |
func getBreadcrumb(id:Int) { | |
let breadcrumbUrl = "https://xxxxx.herokuapp.com/breadcrumbs/\(id).json" | |
Alamofire.request(.GET, breadcrumbUrl).validate().responseJSON { response in | |
switch response.result { | |
case .Success: | |
if let value = response.result.value { | |
let json = JSON(value) | |
let crumb: Dictionary<String,JSON> = json["breadcrumb"].dictionaryValue | |
print(crumb) | |
} | |
case .Failure(let error): | |
print(error) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment