Created
April 16, 2015 17:55
-
-
Save Jan0707/cc8db99778c0f527bef5 to your computer and use it in GitHub Desktop.
Revisions
-
Jan0707 created this gist
Apr 16, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ //: Playground - noun: a place where people can play import UIKit import XCPlayground XCPSetExecutionShouldContinueIndefinitely() let url = NSURL(string: "http://api.tvmaze.com/shows/1?embed=previousepisode")! let session = NSURLSession.sharedSession() session.dataTaskWithURL(url, completionHandler: {(data, response, error) in let json = JSON(data: data) println("Fetching") if let previousEpisodeUrl = json["_links"]["previousepisode"]["href"].URL { println("Result:") println(previousEpisodeUrl) } else { println("Error:") println(json["_links"]["previousepisode"]["href"].error) } }).resume()