From 2abb8d06281ed22df747d9f8d24110850dfcf4e8 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Wed, 4 Mar 2020 12:25:59 +0800 Subject: [PATCH] Formal deprecate the SDWebImageContextCustomManager context option --- SDWebImage/Core/SDWebImageDefine.h | 4 ++-- SDWebImage/Core/UIView+WebCache.m | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SDWebImage/Core/SDWebImageDefine.h b/SDWebImage/Core/SDWebImageDefine.h index 4ad3aca9..52d79674 100644 --- a/SDWebImage/Core/SDWebImageDefine.h +++ b/SDWebImage/Core/SDWebImageDefine.h @@ -213,9 +213,9 @@ FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextSetIma /** A SDWebImageManager instance to control the image download and cache process using in UIImageView+WebCache category and likes. If not provided, use the shared manager (SDWebImageManager *) - @note Consider deprecated. This context options can be replaced by other context option control like `.imageCache`, `.imageLoader`, `.imageTransofmer` (See below), which already matches all the properties in SDWebImageManager. + @deprecated Deprecated. This context options can be replaced by other context option control like `.imageCache`, `.imageLoader`, `.imageTransofmer` (See below), which already matches all the properties in SDWebImageManager. */ -FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCustomManager; +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCustomManager __deprecated_msg("Use individual context option like .imageCache, .imageLoader and .imageTransformer instead"); /** A id instance which conforms to `SDImageCache` protocol. It's used to override the image mananger's cache during the image loading pipeline. diff --git a/SDWebImage/Core/UIView+WebCache.m b/SDWebImage/Core/UIView+WebCache.m index 311dd1ba..7a3ffa6d 100644 --- a/SDWebImage/Core/UIView+WebCache.m +++ b/SDWebImage/Core/UIView+WebCache.m @@ -80,11 +80,13 @@ const int64_t SDWebImageProgressUnitCountUnknown = 1LL; [self sd_startImageIndicator]; id imageIndicator = self.sd_imageIndicator; #endif - +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" SDWebImageManager *manager = context[SDWebImageContextCustomManager]; if (!manager) { manager = [SDWebImageManager sharedManager]; } +#pragma clang diagnostic pop SDImageLoaderProgressBlock combinedProgressBlock = ^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { if (imageProgress) {