Commenting
This commit is contained in:
parent
46e76f0b47
commit
14c608c4a5
@ -13,14 +13,17 @@ extension KeyedDecodingContainer where Key : CodingKey {
|
|||||||
case moleculeName
|
case moleculeName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Decodes the molecule model with the given coding key based on moleculeName
|
||||||
public func decodeMolecule(codingKey: KeyedDecodingContainer<K>.Key) throws -> MoleculeProtocol {
|
public func decodeMolecule(codingKey: KeyedDecodingContainer<K>.Key) throws -> MoleculeProtocol {
|
||||||
return try decodeModel(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName)
|
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<K>.Key) throws -> MoleculeProtocol? {
|
public func decodeMoleculeIfPresent(codingKey: KeyedDecodingContainer<K>.Key) throws -> MoleculeProtocol? {
|
||||||
return try decodeModelIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName)
|
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<K>.Key) throws -> [MoleculeProtocol] {
|
public func decodeMolecules(codingKey: KeyedDecodingContainer<K>.Key) throws -> [MoleculeProtocol] {
|
||||||
guard let models = try decodeModels(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeProtocol] else {
|
guard let models = try decodeModels(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeProtocol] else {
|
||||||
throw ModelRegistry.Error.decoderError
|
throw ModelRegistry.Error.decoderError
|
||||||
@ -28,6 +31,7 @@ extension KeyedDecodingContainer where Key : CodingKey {
|
|||||||
return models
|
return models
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Decodes the list of molecule models with the given coding key based on moleculeName, optional
|
||||||
public func decodeMoleculesIfPresent(codingKey: KeyedDecodingContainer<K>.Key) throws -> [MoleculeProtocol]? {
|
public func decodeMoleculesIfPresent(codingKey: KeyedDecodingContainer<K>.Key) throws -> [MoleculeProtocol]? {
|
||||||
return try decodeModelsIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeProtocol]
|
return try decodeModelsIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeProtocol]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user