Objective-C
[objectArray enumerateObjectsUsingBlock: ^( Object * object,
NSUInteger index,
BOOL * stop )
{
object.name = @"same name";
}
Swift (Indirectly access objects using index)
struct Object
{
var name: Name?
}
for index in 0..<objectArray.count
{
var object = objectArray[index]
object.name = "same name"
}
Swift *** Error ***
"Cannot assign to 'name' in 'object'"
for object in objectArray
{
object.name = "same name"
}