Created
December 19, 2017 16:54
-
-
Save luisburgos/cae3ec50be0e89f0b2e546c6d11c8eb3 to your computer and use it in GitHub Desktop.
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
// | |
// 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