Last active
April 10, 2018 19:00
-
-
Save Kdan/87f1de0527420706d99be9a5730beb6c 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
class Person: Codable { | |
let name: String | |
/// Retrieve the pets of the Person. | |
func getPets(completion: ([Pet]) -> Void) throws { | |
// Networking request omitted for simplicity. | |
let data = responseData | |
completion(try JSONDecoder().decode([ClassWrapper<PetFamily, Pet>].self, from: data).compactMap { $0.object }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment