How to iterate over an NSArrayController contents in swift?

1.2k views Asked by At

I have an array controller which stores managed objects of entity 'Student', I am trying to iterate over its content using below code:

for (index, element) in downloadingFilesArrayController.arrangedObjects{
    // want to do some useful things on element
}

for some reasons it is showing compilation error:

'Type AnyObject does not conform to protocol SequenceType'

Any ideas on how can fix it?

1

There are 1 answers

1
Himanshu gupta On BEST ANSWER

You can do something like this:

for element in downloadingFilesArrayController.arrangedObjects as! [AnyObject] {
    // want to do some useful things on element
}