Last active
August 28, 2017 19:08
-
-
Save vhart/bb467753dd38e562ca5cdd46cb7e8d59 to your computer and use it in GitHub Desktop.
Without JsonDeserializer as a generic constraint
This file contains hidden or 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 SomeDeserializer<T>: JsonDeserializer { | |
private let deserializer: JsonDeserializer | |
init<D: JsonDeserializer>(deserializer: D) where D.Response == T { | |
self.deserializer = deserializer | |
} | |
func parse(json: [String : Any]) -> T { | |
return deserializer.parse(json: json) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment