Skip to content

Instantly share code, notes, and snippets.

@raulriera
Created January 16, 2016 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raulriera/0870d0a52fa25d0e594f to your computer and use it in GitHub Desktop.
Save raulriera/0870d0a52fa25d0e594f to your computer and use it in GitHub Desktop.
Example of the Medium article
public struct UserRequest: DribbbleRequestType {
public typealias Response = User
public var path: String {
return "/user"
}
public func responseFromObject(object: AnyObject, URLResponse: NSHTTPURLResponse) -> Response? {
guard let dictionary = object as? [String: AnyObject] else {
return nil
}
guard let user = try? User.decode(dictionary) else {
return nil
}
return user
}
public init() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment