• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Swift : iterating over NSArrayController arrangedObjects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swift : iterating over NSArrayController arrangedObjects


  • Subject: Re: Swift : iterating over NSArrayController arrangedObjects
  • From: Devarshi Kulshreshtha <email@hidden>
  • Date: Sun, 21 Jun 2015 20:23:39 +0530

Thanks for your help :)

I got it working using this:

for index in downloadingFilesArrayController.arrangedObjects as!
[AnyObject] {
}

On Sun, Jun 21, 2015 at 8:01 PM, Ken Thomases <email@hidden> wrote:

> On Jun 21, 2015, at 8:44 AM, Devarshi Kulshreshtha <
> email@hidden> 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?
>
> The problem is that the arrangedObjects property of NSArrayController is
> typed as "id", not "NSArray*".  Try casting it to an array:
>
> for (index, element) in downloadingFilesArrayController.arrangedObjects
> as! [AnyObject] {
> }
>
> Regards,
> Ken
>
>


--
Thanks,

Devarshi
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >Swift : iterating over NSArrayController arrangedObjects (From: Devarshi Kulshreshtha <email@hidden>)
 >Re: Swift : iterating over NSArrayController arrangedObjects (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Swift : iterating over NSArrayController arrangedObjects
  • Next by Date: Re: Language options: Objective-C, Swift, C or C++?
  • Previous by thread: Re: Swift : iterating over NSArrayController arrangedObjects
  • Next by thread: Autosave + non-file URL's == trouble
  • Index(es):
    • Date
    • Thread