removed unused code
This commit is contained in:
parent
dcd2dc4fd8
commit
8ed40b8a03
@ -66,22 +66,6 @@ public struct ModelRegistry {
|
|||||||
|
|
||||||
return AnyCodingKey(category.codingKey)
|
return AnyCodingKey(category.codingKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static func getModelFor<T>(json: [String: Any], type: T.Type) throws -> ModelProtocol? {
|
|
||||||
|
|
||||||
guard let categoryKey = ModelRegistry.getCategory(for: type)?.codingKey else {
|
|
||||||
throw ModelRegistry.Error.other(message: "coding key missing")
|
|
||||||
}
|
|
||||||
guard let parameterType = json.optionalStringForKey(categoryKey) else {
|
|
||||||
throw ModelRegistry.Error.other(message: "type missing")
|
|
||||||
}
|
|
||||||
|
|
||||||
guard let type = ModelRegistry.getType(for: parameterType, with: type) else {
|
|
||||||
throw ModelRegistry.Error.decoderErrorModelNotMapped()
|
|
||||||
}
|
|
||||||
return try type.decode(jsonDict: json)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension KeyedDecodingContainer where Key: CodingKey {
|
extension KeyedDecodingContainer where Key: CodingKey {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user