I am learned about the retain cycle then I was watching this video tutorial but I felt the code he was writing contain retain cycle. So I thought to post is here to ask opinion. Below the code snippet :
[UIView transitionWithView:self.view duration:.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
self.myImageView.image = randomDog.image;
self.BreedLabel.text = randomDog.breed;
self.nameLabel.text = randomDog.name;
} completion:^(BOOL finished) {
}];
Because Inside the block self is being used and this block will hold on to self as its strong pointer.
I read it somewhere that if one need to use self in side of the block its always good practice to create weekSelf like
id (nonatomic, weak) weakSelf;
weakSelf = self;
and then use the weakSelf inside the block.
Please help me if I understood the concept correctly. Thanks in advance.