remove unused code

This commit is contained in:
Pfeil, Scott Robert 2019-12-18 13:14:56 -05:00
parent fc108373cb
commit e1ecb35531

View File

@ -80,12 +80,7 @@ extension KeyedDecodingContainer where Key: CodingKey {
var models = [Model]() var models = [Model]()
var container = try nestedUnkeyedContainer(forKey: codingKey) var container = try nestedUnkeyedContainer(forKey: codingKey)
var containerCopy = container var containerCopy = container
var i = 0
let count = container.count ?? 0
while !container.isAtEnd { while !container.isAtEnd {
if i < count {
let nestedContainer = try container.nestedContainer(keyedBy: C.self) let nestedContainer = try container.nestedContainer(keyedBy: C.self)
if let identifier = try nestedContainer.decodeIfPresent(String.self, forKey: typeCodingKey) { if let identifier = try nestedContainer.decodeIfPresent(String.self, forKey: typeCodingKey) {
//get the type //get the type
@ -97,10 +92,8 @@ extension KeyedDecodingContainer where Key: CodingKey {
let model = try type.init(from: decoder) let model = try type.init(from: decoder)
models.append(model) models.append(model)
} }
i+=1
} }
} return models
return models.count > 0 ? models : nil
} }
/// Decodes an array of registered model based on the identifiers. /// Decodes an array of registered model based on the identifiers.