Skip to content

Commit

Permalink
demonstrate ways to mention self implicitly in a block
Browse files Browse the repository at this point in the history
  • Loading branch information
mattneub committed Jan 7, 2014
1 parent 7617423 commit 3d47d43
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -121,7 +121,9 @@ @interface FlipsideViewController ()
@property (nonatomic, strong) id observer;
@end

@implementation FlipsideViewController
@implementation FlipsideViewController {
NSString* myIvar;
}

- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
Expand All @@ -135,6 +137,10 @@ - (void) viewWillAppear:(BOOL)animated {
FlipsideViewController* sself = weakself; // <===
if (sself) { // <===
[sself description]; // no leak - be careful not to mention self!
// do not use NSAssert!
// NSAssert(1, @"dummy assertion");
// do not use ivar names!
// myIvar = @"Testing"; // fortunately, compiler warns on this one
}
}];
}
Expand Down

0 comments on commit 3d47d43

Please sign in to comment.