From 2b0b4cf91a5b1372b70531558ca031c7481a3d8b Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 18 Dec 2019 13:26:15 -0500 Subject: [PATCH] use helper function for getting type --- MVMCore/MVMCore/Models/Model/ModelRegistry.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCore/MVMCore/Models/Model/ModelRegistry.swift b/MVMCore/MVMCore/Models/Model/ModelRegistry.swift index e73437c..f1391c1 100644 --- a/MVMCore/MVMCore/Models/Model/ModelRegistry.swift +++ b/MVMCore/MVMCore/Models/Model/ModelRegistry.swift @@ -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