diff --git a/MVMCoreUI/Models/Extensions/ModelHelper.swift b/MVMCoreUI/Models/Extensions/ModelHelper.swift index 1f15274f..c56a0a5a 100644 --- a/MVMCoreUI/Models/Extensions/ModelHelper.swift +++ b/MVMCoreUI/Models/Extensions/ModelHelper.swift @@ -11,12 +11,15 @@ import Foundation extension KeyedDecodingContainer where Key : CodingKey{ + private enum TypeCodingKey: String, CodingKey { + case moleculeName + } public func decode(codingKey: KeyedDecodingContainer.Key) throws -> MoleculeProtocol { - return try decode(codingKey: codingKey, typeCodingKey: .moleculeName) + return try decode(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) } public func decodeIfPresent(codingKey: KeyedDecodingContainer.Key) throws -> MoleculeProtocol? { - return try decodeIfPresent(codingKey: codingKey, typeCodingKey: .moleculeName) + return try decodeIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) } }