• 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: Wrapping NSTask, setting PATH env var to current user's PATH...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrapping NSTask, setting PATH env var to current user's PATH...


  • Subject: Re: Wrapping NSTask, setting PATH env var to current user's PATH...
  • From: "Clark Cox" <email@hidden>
  • Date: Wed, 16 Jan 2008 09:54:41 -0800

On Jan 15, 2008 8:35 PM, John Joyce <email@hidden> wrote:
> Thanks in advance for any replies.
> Looks like I finally found what I was looking for. Mostly it is a
> matter of doing some assuming on common PATH locations to search for
> and then set things up programatically. Looks like I will likely also
> need to programatically look for paths stored
> in .profile, .bash_login, etc... as part of life dealing with NSTask
> tools that may not be default OS X installed tools.
>
> I think my big stumbling block was switching my thinking from Ruby to
> Objective-C object messaging and method syntax. They're not terribly
> far apart conceptually, but the code does read a bit differently.
> The other stumbling block was simply getting used to Cocoa & Obj-C
> conventions and terminology for collections. Simply getting used to
> things like NSDictionary and the Cocoa/Obj-C way of KVC. In Ruby it's
> usually easy arrays and hashes.
>
> One thing I'm still kind of struggling to internalize is
> NSEnumerator. In Ruby, many classes inherit/mix in enumerating
> methods that are very common to its collection types of classes and
> become very core to the way things are very convenient there.
> Can anyone suggest a good tutorial/reference/example code on
> iterating with NSEnumerator and such in Cocoa? ( I hope I'm not
> asking in the wrong list here ).

There isn't much to using NSEnumerator, as it's a very simple class.
Just call -nextObject repeatedly. Each time you call it, you will be
given a subsequent object in the collection being enumerated. When
-nextObject returns nil, you know you've enumerated over the entire
collection.

NSEnumerator *enumerator = [someCollection objectEnumerator];
id element;

while(element = [enumerator nextObject]) {
  /*do something with element here*/
}

--
Clark S. Cox III
email@hidden
_______________________________________________

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: 
 >RE: Wrapping NSTask, setting PATH env var to current user's PATH... (From: John Joyce <email@hidden>)

  • Prev by Date: Re: Has their been a Sketch App Update
  • Next by Date: Re: Source list group item indentation
  • Previous by thread: RE: Wrapping NSTask, setting PATH env var to current user's PATH...
  • Next by thread: CoreData NSTreeController Binding Relationship Problem
  • Index(es):
    • Date
    • Thread