WebImage

YYWebImage

YYImage_sequence.png
YYImage.png

YYImage - base on YYImageDecoder
+imageNamed
+imageWithContentsOfFile
+imageWithData:scale:

YYFrameImage - model
-initWithImagePaths
-initWithImageDataArray

YYSpriteImage - model
-initWithSpriteSheetImage

YYAnimatedImageView - queue for imagePerFrame
_YYAnimatedImageViewFetchOperation
YYAnimatedImage <NSObject>

YYImageCoder
YYImageFrame
YYImageDecoder
YYImageEncoder
UIImage (YYImageCoder)

YYImageCache - base on YYMemory/DiskCache
+sharedCache - once + path
-initWithPath - YYMemory/DiskCache

/p - decodeForDisplay
-set - Memory - image(imageByDecoded) OR (imageData-image)
- Disk - imageData OR (image-data)
-get
-removeForkey
-contains

YYWebImageOperation - NSURLConnection + state + _cache + holdThread + callbackAllBlock + delegate
i. -initWithRequest
ii. _startOperation - memory cache + _options(disk cache) OR _startRequest
iii. -delegate - Challenge + URLCache + (error & data) + progressive(YYImageDecoder)* + (imageType(cache) + transformBlock)
iv. -override - Activity + _completion + _startOperation + bgTask

YYWebImageManager
+sharedManager
-initWithCache:queue
-requestImageWithURL - YYWebImageOperation

——————————

Entry Point:

UIImageView (YYWebImage)
-setImageWithURL

UIButton (YYWebImage)
_YYWebImageSetterDicForButton
-setImageWithURL:forState

CALayer (YYWebImage)
-setImageWithURL

MKAnnotationView (YYWebImage)
-setImageWithURL

_YYWebImageSetter
-setOperationWithSentinel - NSOperation
-cancelWithNewURL - _operation cancel



SDWebImage

SDWebImage_sequence.png
SDWebImage.png

SDWebImageCompat
SDWebImageOperation <NSObject>
-cancel

SDWebImageDownloader - NSOperationQueue + NSURLSession
+sharedDownloader
-initWithSessionConfiguration
-downloadImageWithURL - addProgressCallback - (SDWebImageDownloaderOperation(request+credential+queue) & SDWebImageDownloadToken)
-delegate

SDWebImageDownloaderOperation - state + dataTask + callbackAllBlock + notification
OperationInterface<NSObject>
-initWithRequest
-addHandlersForProgress

-start - bgTask + options + dataTask + progressBlock
-cancel - dataTaskCancel + notification
-delegate - options(ProgressiveDownload) + progressBlock + completionBlock + URLCache + Challenge + (decodedImage & shouldDecompressImages)

SDImageCache
SDImageCacheConfig - model

SDWebImageCodersManager

SDWebImageManager - cache & downloader
+sharedManager
-initWithCache:downloader:
-loadImageWithURL - operation.cacheBlock{ download(options + downloader{image}) + cache + none }

SDWebImagePrefetcher
SDWebImageTransition - model

——————————

NSData (ImageContentType)
-sd_imageFormatForImageData
-sd_UTTypeFromSDImageFormat

UIImage (GIF)
UIImage (MultiFormat)
UIImage (WebP)
UIImage (ForceDecode)

UIView (WebCacheOperation) - AssociatedMapTable
-sd_setImageLoadOperation
-sd_cancelImageLoadOperationWithKey
-sd_removeImageLoadOperationWithKey

——————————

Entry Point:

MKAnnotationView (WebCache) - UIView (WebCache)
-sd_setImageWithURL

UIButton (WebCache) - UIView (WebCache)
-sd_setImageWithURL:forState
-AssociatedDict cache

UIImageView (WebCache) - UIView (WebCache)
-sd_setImageWithURL
-sd_setAnimationImagesWithURLs - PointerAssociatedArray<SDWebImageOperation>

UIImageView (HighlightedWebCache) - UIView (WebCache)
-sd_setHighlightedImageWithURL

FLAnimatedImageView (WebCache)
-sd_setImageWithURL

UIView (WebCache)
-AssociatedURL&Progress
-&SDWebImageTransition&(UIActivityIndicatorView&show&style)

-sd_internalSetImageWithURL - self.NSProgress + progressBlock + completedBlock + about SDWebImageOptions + cache
-sd_setImage - UIImageView & UIButton + transition

推荐阅读更多精彩内容