Created
December 1, 2015 12:55
-
-
Save masuhara/603666c3059383cc9868 to your computer and use it in GitHub Desktop.
TokyoMetroAPI
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
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet var label: UILabel! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
@IBAction func getTrainInformation() { | |
let url = NSURL(string: "https://api.tokyometroapp.jp/api/v2/datapoints?rdf:type=odpt:Train&acl:consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXX") | |
let request = NSMutableURLRequest(URL: url!) | |
request.HTTPMethod = "GET" | |
let session = NSURLSession.sharedSession() | |
let task = session.dataTaskWithRequest(request, completionHandler: { data, response, error in | |
print(NSString(data: data!, encoding: NSUTF8StringEncoding)) | |
}) | |
task.resume() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment