From 320cd153921dd6b9f524380a38d72195ab1222e8 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Fri, 1 Jul 2022 15:26:09 -0400 Subject: [PATCH] Modernize actions --- MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift index f88ca5ec..01a7d0e8 100644 --- a/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift +++ b/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift @@ -9,16 +9,7 @@ public extension Dictionary { func asActionModel() throws -> ActionModelProtocol { - guard let castedSelf = self as? [String: Any] else { - throw ModelRegistry.Error.decoderOther(message: "Dictionary is not of type [String: Any]") - } - guard let actionType = ModelRegistry.getType(for: castedSelf.stringForkey(KeyActionType), with: ActionModelProtocol.self) else { - throw ModelRegistry.Error.decoderErrorModelNotMapped() - } - guard let actionModel = try actionType.decode(jsonDict: castedSelf) as? ActionModelProtocol else { - throw ModelRegistry.Error.decoderOther(message: "Could not decode to ActionModelProtocol") - } - return actionModel + return try MVMCoreActionHandler.createModel(with: self) } - + }