> On 21 Jun 2015, at 21:44, Devarshi Kulshreshtha <devarshi.bluec...@gmail.com> 
> wrote:
> 
> 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?

You’re trying to iterate an array of something and put each element into a 
tuple of ( index, element ), that’s not going to work. 

Either 

for element in downlaodFileArrayController.arrangedObects {} 

or

for (index, element ) in 
downloadingFilesArrayControler.arrangedObjects.enumerate() {}

If you’re on Swift 1.2 I think it’s enumerate( 
downloadingFilesArrayController.arrangedObjects ) instead of the enumerate on 
the end. 

Can’t say the error message makes any sense to me however, not that the one I 
get in Xcode 7 makes much more sense. 


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to