As the other practice in weak and strong, it recommends that we should check whether the weakself is null before we strongify it. It looks like this:
__weak weakself = self
someblock {
if (weakself) {
__strong self = weakself
[self doSomeAction];
...
}
}
I know rac does a lot of work ahead, but I want to make sure whether it's necessary that we should check it or not. And if not, how does the @strongify(self) do this. Thanks.
No, you should check after
strongify, because it can stop existing till you strongify it.After strongify it won't stop existing anyway, even check for
nilwill not required any synchronizations. I don't know where you did get such invalid recommendations.@strongify do it exactly in such way how you already write, it's just a convenience macro: