What if I have a class Foo declared like:
@interface Foo : NSObject
@property (copy, nonatomic) void (^aBlock)(void);
- (void)bar;
@end
@implementation Foo
- (void)bar {}
@end
and I store in Foo instance a block that captures this instance itself:
Foo *foo = [Foo new];
__weak Foo *weakFoo = foo;
foo.aBlock = ^{
__strong Foo *strongFoo = weakFoo; <--- does this __strong Foo * really makes sense?
[strongFoo bar];
}
... then somewhere later use foo.aBlock()
or I just do:
Foo *foo = [Foo new];
__weak Foo *weakFoo = foo;
foo.aBlock = ^{
[weakFoo bar];
}
... then somewhere later use foo.aBlock()
Does adding of __strong *strongFoo = weakFoo
makes any sense or is it enough to use just [weakFoo bar]
inside a block?