extension Array {
func removeObject(object: T) {
var index = find(self, object)
self.removeAtIndex(index)
}
}
>
I managed to remove a [String:AnyObject]
from an array [[String:AnyObject]]
by implementing a count outside of a for loop to represent the index since .find
and .filter
are not compatible with [String:AnyObject]
.
let additionValue = productHarvestChoices[trueIndex]["name"] as! String
var count = 0
for productHarvestChoice in productHarvestChoices {
if productHarvestChoice["name"] as! String == additionValue {
productHarvestChoices.removeAtIndex(count)
}
count = count + 1
}