Created
April 16, 2015 17:55
-
-
Save Jan0707/cc8db99778c0f527bef5 to your computer and use it in GitHub Desktop.
SwiftyJSONDebug.swift
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
//: 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment