From 14c608c4a5d91ebfc70d544bc51d6bd6c1745a77 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 18 Dec 2019 16:10:15 -0500 Subject: [PATCH] Commenting --- MVMCoreUI/Models/Extensions/ModelHelper.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MVMCoreUI/Models/Extensions/ModelHelper.swift b/MVMCoreUI/Models/Extensions/ModelHelper.swift index fc0616c1..7c73f264 100644 --- a/MVMCoreUI/Models/Extensions/ModelHelper.swift +++ b/MVMCoreUI/Models/Extensions/ModelHelper.swift @@ -13,14 +13,17 @@ extension KeyedDecodingContainer where Key : CodingKey { case moleculeName } + /// Decodes the molecule model with the given coding key based on moleculeName public func decodeMolecule(codingKey: KeyedDecodingContainer.Key) throws -> MoleculeProtocol { return try decodeModel(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) } + /// Decodes the molecule model with the given coding key based on moleculeName, optional public func decodeMoleculeIfPresent(codingKey: KeyedDecodingContainer.Key) throws -> MoleculeProtocol? { return try decodeModelIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) } + /// Decodes the list of molecule models with the given coding key based on moleculeName public func decodeMolecules(codingKey: KeyedDecodingContainer.Key) throws -> [MoleculeProtocol] { guard let models = try decodeModels(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeProtocol] else { throw ModelRegistry.Error.decoderError @@ -28,6 +31,7 @@ extension KeyedDecodingContainer where Key : CodingKey { return models } + /// Decodes the list of molecule models with the given coding key based on moleculeName, optional public func decodeMoleculesIfPresent(codingKey: KeyedDecodingContainer.Key) throws -> [MoleculeProtocol]? { return try decodeModelsIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeProtocol] }