On Oct 24, 2014, at 5:24 PM, Rick Mann <rm...@latencyzero.com> wrote: > > I discovered a neat property of Swift: Anywhere I can pass a closure, I can > also pass a object method (of matching type), and if I reference it from an > instance, it captures that instance for the call: > > class > Foo > { > func actOnFoo(inValue: Int) > { > } > } > > func > neato() > { > var foo: Foo = Foo(); > doSomething(foo.actOnFoo); > } > > func > doSomething(inFunc: (Int) -> ()) > { > } > > Inside doSomething(), is it possible to get at inFunc's "self" (in this case, > it would be foo)?
Imagine there were a keyword that allowed this. What would it evaluate to if the caller *didn’t* pass in a method, but rather a pure closure? --Kyle Sluder _______________________________________________ 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