I have array:
var arrDicContact = udContact.valueForKey("arrDicContact") as [NSDictionary]
and i want to change one contact in array:
for let dicx:NSDictionary in arrDicContact{
if (dic.valueForKey("name") as String) == selectedName{
//how to modify dic to newdic: dic = newdic
}
}
i can use for loop with int i from 0 to arrDicContact.count-1. But it's so not exited… i like for loop (for…in…) So anybody help me! 🙂 Tks a lot.
Best Solution
Assuming we have the array like this:
Using
enumerate
Iterate over
indices
:More aggressively, replace whole
array
usingmap
: