Skip to content

Instantly share code, notes, and snippets.

@jeffbailey
Created April 28, 2014 15:27
Show Gist options
  • Save jeffbailey/11375441 to your computer and use it in GitHub Desktop.
Save jeffbailey/11375441 to your computer and use it in GitHub Desktop.
Example of capturing a weak reference in a block and converting to a strong reference when the block executes.
__weak typeof(self) weakSelf = self;
[self doABlockOperation:^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (strongSelf) {
...
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment