 }
 
 extension GitHubRequestType {
-    var baseURL: NSURL {
-        return NSURL(string: "https://api.github.com")!
+    var baseURL: URL {
+        return URL(string: "https://api.github.com")!
     }
 }
 
 //: Step 2: Create model object
 struct RateLimit {
     let count: Int
-    let resetDate: NSDate
+    let resetDate: Date
 
     init?(dictionary: [String: AnyObject]) {
         guard let count = dictionary["rate"]?["limit"] as? Int else {
             return nil
         }
 
-        guard let resetDateString = dictionary["rate"]?["reset"] as? NSTimeInterval else {
+        guard let resetDateString = dictionary["rate"]?["reset"] as? TimeInterval else {
             return nil
         }
 
         self.count = count
-        self.resetDate = NSDate(timeIntervalSince1970: resetDateString)
+        self.resetDate = Date(timeIntervalSince1970: resetDateString)
     }
 }
 

import XCPlayground
import UIKit
import APIKit

XCPlaygroundPage.currentPage.needsIndefiniteExecution = true

//: Step 1: Define request protocol
protocol GitHubRequestType: RequestType {

        return "/rate_limit"
    }

    func responseFromObject(_ object: AnyObject, urlResponse: HTTPURLResponse) throws -> Response {
        guard let dictionary = object as? [String: AnyObject],
              let rateLimit = RateLimit(dictionary: dictionary) else {
            throw ResponseError.UnexpectedObject(object)
