add decode array method
This commit is contained in:
parent
46c092f99c
commit
eb4e8fd816
@ -102,6 +102,13 @@ extension KeyedDecodingContainer where Key: CodingKey {
|
||||
}
|
||||
return models.count > 0 ? models : nil
|
||||
}
|
||||
|
||||
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 models
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user