So my code hasn't crashed, but this feels like it shouldn't be safe, but I can't find a clear answer in the swift docs. I'm iterating over a dictionary with a for-in loop and removing those elements if not found in a reference array. I'm wondering if this is safe, and if so, why?
func cleanupETADictionary(trips: [Int64]){
for (tripId, _) in etaDictionary{
if !trips.contains(tripId){
etaDictionary.removeValue(forKey: tripId)
}
}
}