Skip to content

Instantly share code, notes, and snippets.

@luisburgos
Created December 19, 2017 16:54
Show Gist options
  • Save luisburgos/cae3ec50be0e89f0b2e546c6d11c8eb3 to your computer and use it in GitHub Desktop.
Save luisburgos/cae3ec50be0e89f0b2e546c6d11c8eb3 to your computer and use it in GitHub Desktop.
//
// UserParser.swift
// Tripstr
//
// Created by Luis Burgos on 11/24/17.
// Copyright © 2017 Tripstr. All rights reserved.
//
import Foundation
import SwiftyJSON
class UserParser: Parser {
func parse(_ json: JSON) throws -> [APIModel]? {
let user = try User.init(json: json)
return [user]
}
}
class UserListParser: Parser {
func parse(_ json: JSON) throws -> [APIModel]? {
return User.toList(from: json, parser: UserParser())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment