Re: completion handlers?
Re: completion handlers?
- Subject: Re: completion handlers?
- From: Steven Degutis <email@hidden>
- Date: Sun, 6 Sep 2009 15:22:28 -0500
As mentioned before, the new feature is called Blocks, and is available only
for Snow Leopard for the moment (probably being ported to the iPhone too).
I've written an introductory guide on what they are and how they work,
specifically intended for people who have experience with Objective-C and/or
Cocoa, but never heard of Blocks before. Here's the link:
http://www.degutis.org/dev/2009/08/30/beginners-guide-to-blocks-in-cocoa/
In a nutshell, Blocks are very simple, and greatly improve your code's
readability and maintainability. (And yes, they work for C as well as ObjC!)
--
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
On Sun, Sep 6, 2009 at 2:56 PM, Todd Heberlein <email@hidden>wrote:
> It seems that the way I previously used an NSSavePanel has been deprecated.
> :(
>
> The new approach seems to use an approach (a function definition embedded
> in the message) that I am not familiar with (I hear ghosts of lambda
> notation whispering into my ear). I assume this is an Objective C 2.0
> feature, but I am not even sure of the name for this approach.
>
> I would like to look up information on this approach, but I don't even know
> a name for it in order to google it. Could someone give me a pointer for
> pages or keywords?
>
> Thanks,
>
> Todd
>
>
> [savePanel beginSheetModalForWindow:window completionHandler:^(NSInteger
> result) {
> if (result) {
> NSLog(@"Save as: %@", savePanel.URL);
> }
> }];
> _______________________________________________
>
> 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
>
_______________________________________________
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