> On Aug 14, 2015, at 4:24 PM, Rick Mann <rm...@latencyzero.com> wrote: > > I really would've hoped that since the closure is defined within the scope of > an instance of the class, that it would have a self made available to it. > I've seen similar code that used "[unowned self] in" to use a weak reference.
Well, that code is different because ‘self’ is already a variable available in the local scope outside the block. In the case you’ve got, there is no local scope outside the block. This seems like a reasonable feature to add to the language though — this kind of lazy ivar initializer is the moral equivalent of a method, so it should have ‘self’ available as a local. Especially since ’self’ is implicitly available already, i.e. you can already refer to local variables or call methods on self inside that block. File a Radar! But yeah, as you said, the workaround would be to add a createBackgroundSession() method and make the lazy block call it. —Jens _______________________________________________ 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