decodeArray return empty array

This commit is contained in:
panxi 2019-12-13 11:04:32 -05:00
parent 3842858443
commit d7a7425bb3

View File

@ -105,7 +105,7 @@ extension KeyedDecodingContainer where Key: CodingKey {
public func decodeArray<C:CodingKey>(codingKey: KeyedDecodingContainer<K>.Key, typeCodingKey: C) throws -> [Model] {
guard let models: [Model] = try decodeArrayIfPresent(codingKey: codingKey, typeCodingKey: typeCodingKey) else {
throw ModelRegistry.Error.decoderErrorObjectNotPresent
return [Model]()
}
return models
}