From 95be2aad358015c5bf9f3391c89baa9374f69eae Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Tue, 6 Nov 2012 18:28:14 +0100 Subject: [PATCH] Inline conditions are baaad --- SDWebImage/MKAnnotationView+WebCache.m | 10 ++++++++-- SDWebImage/UIButton+WebCache.m | 20 ++++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/SDWebImage/MKAnnotationView+WebCache.m b/SDWebImage/MKAnnotationView+WebCache.m index be49ecbf..0c9dd759 100644 --- a/SDWebImage/MKAnnotationView+WebCache.m +++ b/SDWebImage/MKAnnotationView+WebCache.m @@ -48,8 +48,14 @@ static char operationKey; { id operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) { - if (image) self.image = image; - if (completedBlock && finished) completedBlock(image, error, fromCache); + if (image) + { + self.image = image; + } + if (completedBlock && finished) + { + completedBlock(image, error, fromCache); + } }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } diff --git a/SDWebImage/UIButton+WebCache.m b/SDWebImage/UIButton+WebCache.m index 1705d6d0..a5ecf34b 100644 --- a/SDWebImage/UIButton+WebCache.m +++ b/SDWebImage/UIButton+WebCache.m @@ -47,8 +47,14 @@ static char operationKey; { id operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) { - if (image) [self setImage:image forState:state]; - if (completedBlock && finished) completedBlock(image, error, fromCache); + if (image) + { + [self setImage:image forState:state]; + } + if (completedBlock && finished) + { + completedBlock(image, error, fromCache); + } }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } @@ -89,8 +95,14 @@ static char operationKey; { id operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) { - if (image) [self setBackgroundImage:image forState:state]; - if (completedBlock && finished) completedBlock(image, error, fromCache); + if (image) + { + [self setBackgroundImage:image forState:state]; + } + if (completedBlock && finished) + { + completedBlock(image, error, fromCache); + } }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); }