Re: NSURLDownload and userInfo
Re: NSURLDownload and userInfo
- Subject: Re: NSURLDownload and userInfo
- From: Adam Leonard <email@hidden>
- Date: Wed, 12 Mar 2008 10:38:34 -0700
Well, there are a few more places I see it used for delegate-like
operations :)
NSCachedURLResponse - also in WebKit
NSTrackingArea
NSEvent (called userData)
NSBeginAlertSheet() (called contextInfo)
So yeah, you are right it is not used everywhere, but I think it is
used enough for it to be treated as a standard pattern. I have also
seen some open source projects that use it. I still think your
approach is completely valid though; it really depends on how much
control you need.
Adam Leonard
On Mar 12, 2008, at 9:05 AM, Jens Alfke wrote:
On 12 Mar '08, at 12:39 AM, Trygve Inda wrote:
I am surprised NSURLDownload and
NSURLRequest do not have userInfo ivars like many other Cocoa
classes
that do asynchronous operations (NSTimer for instance).
Thanks for this. I too am surprised there is no userInfo in these
classes
and wanted to be sure I wasn't overlooking something.
I looked through the Foundation and AppKit headers, and the _only_
class that has an "id userInfo" property like this is NSTimer. (I
wasn't even aware of it; I've never found a need for it.) So I don't
think it's a widespread technique.
(There are immutable value objects like NSError and NSNotification
that have userInfo dicts, but that's to provide metadata about the
object's value, not as an alternative to subclassing.)
—Jens
_______________________________________________
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