Last active
April 10, 2018 18:15
-
-
Save Kdan/5bd4dbd9ccb42fbd949f11c6b032c366 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
/// To support a new class family, create an enum that conforms to this protocol and contains the different types. | |
protocol ClassFamily: Decodable { | |
/// The discriminator key. | |
static var discriminator: Discriminator { get } | |
/// Returns the class type of the object coresponding to the value. | |
func getType() -> AnyObject.Type | |
} | |
/// Discriminator key enum used to retrieve discriminator fields in JSON payloads. | |
enum Discriminator: String, CodingKey { | |
case type = "type" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment