Skip to content

Instantly share code, notes, and snippets.

@McZonk
Last active December 16, 2015 23:49
Show Gist options
  • Save McZonk/5516682 to your computer and use it in GitHub Desktop.
Save McZonk/5516682 to your computer and use it in GitHub Desktop.
overriding self might seem strange, but it ensure that you cannot accidentally use the strong self.
- (void)foo
{
__weak __typeof__(self) weakSelf = self;
dispatch_async(queue, ^{
__typeof__(self) self = weakSelf;
[self bar];
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment