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) } - + }