use helper function for getting type
This commit is contained in:
parent
326f761f4f
commit
2b0b4cf91a
@ -54,7 +54,7 @@ extension KeyedDecodingContainer where Key: CodingKey {
|
||||
}
|
||||
|
||||
//get the type
|
||||
guard let type = ModelRegistry.types[identifier] else {
|
||||
guard let type = ModelRegistry.getType(for: identifier) else {
|
||||
MVMCoreLoggingHandler.logDebugMessage(withDelegate: "Model not mapped: \(identifier)")
|
||||
throw ModelRegistry.Error.decoderErrorModelNotMapped
|
||||
}
|
||||
@ -80,7 +80,7 @@ extension KeyedDecodingContainer where Key: CodingKey {
|
||||
let nestedContainer = try container.nestedContainer(keyedBy: C.self)
|
||||
if let identifier = try nestedContainer.decodeIfPresent(String.self, forKey: typeCodingKey) {
|
||||
//get the type
|
||||
guard let type = ModelRegistry.types[identifier] else {
|
||||
guard let type = ModelRegistry.getType(for: identifier) else {
|
||||
throw ModelRegistry.Error.decoderErrorModelNotMapped
|
||||
}
|
||||
//now get the decoder to use for the type
|
||||
|
||||
Loading…
Reference in New Issue
Block a user