diff --git a/CHANGELOG.md b/CHANGELOG.md index 1763d3ce..0dab3171 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,7 +80,7 @@ See the [5.0 Migration Guide](https://raw.githubusercontent.com/rs/SDWebImage/5. - `SDImageCache` now uses `NSData writeToFile:options:error` instead of `NSFileManager createFileAtPath:contents:attributes` #2148 - Moved `SDImageCache maxMemoryCost` and `SDImageCache maxMemoryCountLimit` to `SDImageCacheConfig` #2151 - Added `SDImageCache diskImageDataExistsWithKey:` synchronous method #2151 -- Moved `UIImage sd_imageLoopCount` and `UIImage isGIF` (and renamed to `sd_isAnimated`) to `UIImage+WebCache` category, removed the outdated methods #2152 +- Moved `UIImage sd_imageLoopCount` and `UIImage isGIF` (and renamed to `sd_isAnimated`) to `UIImage+Metadata` category, removed the outdated methods #2152 - Move context and other type definitions to a separate header (`SDWebImageDefine`) to allow to be included without dependency #2188 - Pass `context` arg from the top level APIs to the bottom level APIs to allow specify logic in the future #2189 d6a3e2c c24c3d3 - Refactor the image indicator by creating `SDWebImageIndicator` and `SDWebImageProgressIndicator` protocols and two concrete classes that implement activity and progress indicators for both UIKit and AppKit #2185 46b62cf diff --git a/Docs/API-Diff/5.0/apidiff.html b/Docs/API-Diff/5.0/apidiff.html index 02d5349f..13c7d66c 100644 --- a/Docs/API-Diff/5.0/apidiff.html +++ b/Docs/API-Diff/5.0/apidiff.html @@ -5,17 +5,71 @@ +
+
FLAnimatedImage.h
+ +
+
Removed kFLAnimatedImageDelayTimeIntervalMinimum
+
Removed FLAnimatedImage
+
Removed FLAnimatedImage.posterImage
+
Removed FLAnimatedImage.size
+
Removed FLAnimatedImage.loopCount
+
Removed FLAnimatedImage.delayTimesForIndexes
+
Removed FLAnimatedImage.frameCount
+
Removed FLAnimatedImage.frameCacheSizeCurrent
+
Removed FLAnimatedImage.frameCacheSizeMax
+
Removed -[FLAnimatedImage imageLazilyCachedAtIndex:]
+
Removed +[FLAnimatedImage sizeForImage:]
+
Removed -[FLAnimatedImage initWithAnimatedGIFData:]
+
Removed -[FLAnimatedImage initWithAnimatedGIFData:optimalFrameCacheSize:predrawingEnabled:]
+
Removed +[FLAnimatedImage animatedImageWithGIFData:]
+
Removed FLAnimatedImage.data
+
Removed FLLogLevel
+
Removed FLLogLevelNone
+
Removed FLLogLevelError
+
Removed FLLogLevelWarn
+
Removed FLLogLevelInfo
+
Removed FLLogLevelDebug
+
Removed FLLogLevelVerbose
+
Removed +[FLAnimatedImage setLogBlock:logLevel:]
+
Removed +[FLAnimatedImage logStringFromBlock:withLevel:]
+
Removed #def FLLog
+
Removed FLWeakProxy
+
Removed +[FLWeakProxy weakProxyForObject:]
+
+ +
+ +
+
FLAnimatedImageView.h
+ +
+
Removed FLAnimatedImageView
+
Removed FLAnimatedImageView.animatedImage
+
Removed FLAnimatedImageView.loopCompletionBlock
+
Removed FLAnimatedImageView.currentFrame
+
Removed FLAnimatedImageView.currentFrameIndex
+
Removed FLAnimatedImageView.runLoopMode
+
+ +
+
FLAnimatedImageView+WebCache.h
-
Modified -[FLAnimatedImageView sd_setImageWithURL:placeholderImage:options:progress:completed:]
- - - - -
Declaration
From- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock
To- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock
-
+
Removed UIImage (FLAnimatedImage)
+
Removed UIImage.sd_FLAnimatedImage
+
Removed FLAnimatedImageView.sd_optimalFrameCacheSize
+
Removed FLAnimatedImageView.sd_predrawingEnabled
+
Removed FLAnimatedImageView.sd_cacheFLAnimatedImage
+
Removed -[FLAnimatedImageView sd_setImageWithURL:]
+
Removed -[FLAnimatedImageView sd_setImageWithURL:placeholderImage:]
+
Removed -[FLAnimatedImageView sd_setImageWithURL:placeholderImage:options:]
+
Removed -[FLAnimatedImageView sd_setImageWithURL:completed:]
+
Removed -[FLAnimatedImageView sd_setImageWithURL:placeholderImage:completed:]
+
Removed -[FLAnimatedImageView sd_setImageWithURL:placeholderImage:options:completed:]
+
Removed -[FLAnimatedImageView sd_setImageWithURL:placeholderImage:options:progress:completed:]
@@ -24,9 +78,43 @@
MKAnnotationView+WebCache.h
-
Added -[MKAnnotationView sd_setImageWithURL:placeholderImage:options:context:]
-
Added -[MKAnnotationView sd_setImageWithURL:placeholderImage:options:progress:completed:]
-
Added -[MKAnnotationView sd_setImageWithURL:placeholderImage:options:context:progress:completed:]
+
Removed MKAnnotationView (WebCache)
+
Removed -[MKAnnotationView sd_setImageWithURL:]
+
Removed -[MKAnnotationView sd_setImageWithURL:placeholderImage:]
+
Removed -[MKAnnotationView sd_setImageWithURL:placeholderImage:options:]
+
Removed -[MKAnnotationView sd_setImageWithURL:completed:]
+
Removed -[MKAnnotationView sd_setImageWithURL:placeholderImage:completed:]
+
Removed -[MKAnnotationView sd_setImageWithURL:placeholderImage:options:completed:]
+
+ + + +
+
NSData+ImageContentType.h
+ +
+
Removed SDImageFormatUndefined
+
Removed SDImageFormatJPEG
+
Removed SDImageFormatPNG
+
Removed SDImageFormatGIF
+
Removed SDImageFormatTIFF
+
Removed SDImageFormatWebP
+
Removed SDImageFormatHEIC
+
Removed SDImageFormatHEIF
+
Removed +[NSData sd_UTTypeFromSDImageFormat:]
+
+ + +
+
Added SDImageFormatUndefined
+
Added SDImageFormatJPEG
+
Added SDImageFormatPNG
+
Added SDImageFormatGIF
+
Added SDImageFormatTIFF
+
Added SDImageFormatWebP
+
Added SDImageFormatHEIC
+
Added SDImageFormatHEIF
+
Added +[NSData sd_UTTypeFromImageFormat:]
@@ -36,10 +124,11 @@
Added SDAnimatedImage
+
Added -[SDAnimatedImage initWithData:scale:options:]
Added -[SDAnimatedImage initWithAnimatedCoder:scale:]
Added -[SDAnimatedImage preloadAllFrames]
Added -[SDAnimatedImage unloadAllFrames]
-
Added -[SDAnimatedImage isAllFramesLoaded]
+
Added SDAnimatedImage.allFramesLoaded
Added SDAnimatedImage
Added +[SDAnimatedImage imageNamed:]
Added +[SDAnimatedImage imageNamed:inBundle:compatibleWithTraitCollection:]
@@ -49,7 +138,6 @@
Added -[SDAnimatedImage initWithContentsOfFile:]
Added -[SDAnimatedImage initWithData:]
Added -[SDAnimatedImage initWithData:scale:]
-
Added -[SDAnimatedImage initWithAnimatedCoder:scale:]
Added SDAnimatedImage.animatedImageFormat
Added SDAnimatedImage.animatedImageData
Added SDAnimatedImage.scale
@@ -111,6 +199,7 @@
Added -[SDDiskCache totalSize]
Added SDDiskCache
Added SDDiskCache.config
+
Added -[SDDiskCache moveCacheDirectoryFromPath:toPath:]
@@ -304,10 +393,12 @@
Added SDImageCoderOption
Added SDImageCoderOptions
+
Added SDImageCoderMutableOptions
Added SDImageCoderDecodeFirstFrameOnly
Added SDImageCoderDecodeScaleFactor
Added SDImageCoderEncodeFirstFrameOnly
Added SDImageCoderEncodeCompressionQuality
+
Added SDImageCoderWebImageContext
Added SDImageCoder
Added -[SDImageCoder canDecodeFromData:]
Added -[SDImageCoder decodedImageWithData:options:]
@@ -319,9 +410,9 @@
Added -[SDProgressiveImageCoder updateIncrementalData:finished:]
Added -[SDProgressiveImageCoder incrementalDecodedImageWithOptions:]
Added SDAnimatedImageProvider
-
Added -[SDAnimatedImageProvider animatedImageData]
-
Added -[SDAnimatedImageProvider animatedImageFrameCount]
-
Added -[SDAnimatedImageProvider animatedImageLoopCount]
+
Added SDAnimatedImageProvider.animatedImageData
+
Added SDAnimatedImageProvider.animatedImageFrameCount
+
Added SDAnimatedImageProvider.animatedImageLoopCount
Added -[SDAnimatedImageProvider animatedImageFrameAtIndex:]
Added -[SDAnimatedImageProvider animatedImageDurationAtIndex:]
Added SDAnimatedImageCoder
@@ -429,7 +520,7 @@
Added SDTransformedKeyForKey()
Added SDImageTransformer
-
Added -[SDImageTransformer transformerKey]
+
Added SDImageTransformer.transformerKey
Added -[SDImageTransformer transformedImageWithImage:forKey:]
Added SDImagePipelineTransformer
Added SDImagePipelineTransformer.transformers
@@ -576,6 +667,12 @@
Removed #def dispatch_queue_async_safe
+ +
+
Added #def SD_LOCK
+
Added #def SD_UNLOCK
+
+
@@ -596,7 +693,6 @@
Added SDWebImageDecodeFirstFrameOnly
Added SDWebImagePreloadAllFrames
Added SDWebImageContextSetImageOperationKey
-
Added SDWebImageContextSetImageGroup
Added SDWebImageContextCustomManager
Added SDWebImageContextImageTransformer
Added SDWebImageContextImageScaleFactor
@@ -721,6 +817,7 @@
Added SDWebImageDownloaderConfig.defaultDownloaderConfig
Added SDWebImageDownloaderConfig.maxConcurrentDownloads
Added SDWebImageDownloaderConfig.downloadTimeout
+
Added SDWebImageDownloaderConfig.minimumProgressInterval
Added SDWebImageDownloaderConfig.sessionConfiguration
Added SDWebImageDownloaderConfig.operationClass
Added SDWebImageDownloaderConfig.executionOrder
@@ -743,6 +840,7 @@
Removed -[SDWebImageDownloaderOperationInterface credential]
Removed -[SDWebImageDownloaderOperationInterface setCredential:]
Removed -[SDWebImageDownloaderOperationInterface cancel:]
+
Removed -[SDWebImageDownloaderOperationInterface dataTask]
Removed SDWebImageDownloaderOperation.shouldDecompressImages
Removed SDWebImageDownloaderOperation.shouldUseCredentialStorage
Removed SDWebImageDownloaderOperation.expectedSize
@@ -754,12 +852,13 @@
Added -[SDWebImageDownloaderOperation initWithRequest:inSession:options:]
Added -[SDWebImageDownloaderOperation initWithRequest:inSession:options:context:]
Added -[SDWebImageDownloaderOperation addHandlersForProgress:completed:]
-
Added -[SDWebImageDownloaderOperation credential]
-
Added -[SDWebImageDownloaderOperation setCredential:]
Added -[SDWebImageDownloaderOperation cancel:]
-
Added -[SDWebImageDownloaderOperation request]
-
Added -[SDWebImageDownloaderOperation response]
-
Added -[SDWebImageDownloaderOperation dataTask]
+
Added SDWebImageDownloaderOperation.request
+
Added SDWebImageDownloaderOperation.response
+
Added SDWebImageDownloaderOperation.dataTask
+
Added SDWebImageDownloaderOperation.credential
+
Added SDWebImageDownloaderOperation.minimumProgressInterval
+
Added SDWebImageDownloaderOperation.minimumProgressInterval
Added SDWebImageDownloaderOperation.context
Added -[SDWebImageDownloaderOperation initWithRequest:inSession:options:context:]
@@ -769,7 +868,7 @@
Modified SDWebImageDownloaderOperation
- +
Protocols
FromNSURLSessionDataDelegate, NSURLSessionTaskDelegate, SDWebImageDownloaderOperationInterface, SDWebImageOperation
FromSDWebImageDownloaderOperationInterface, SDWebImageOperation
ToSDWebImageDownloaderOperation

@@ -861,7 +960,7 @@
Added SDWebImageIndicator
-
Added -[SDWebImageIndicator indicatorView]
+
Added SDWebImageIndicator.indicatorView
Added -[SDWebImageIndicator startAnimatingIndicator]
Added -[SDWebImageIndicator stopAnimatingIndicator]
Added -[SDWebImageIndicator updateIndicatorProgress:]
@@ -1155,6 +1254,8 @@
Removed -[UIImageView sd_setImageWithPreviousCachedImageWithURL:placeholderImage:options:progress:completed:]
+
Removed -[UIImageView sd_setAnimationImagesWithURLs:]
+
Removed -[UIImageView sd_cancelCurrentAnimationImagesLoad]
@@ -1199,6 +1300,13 @@
+
Modified SDSetImageBlock
+ + + + +
Declaration
Fromtypedef void (^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData)
Totypedef void (^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL)
+
Modified -[UIView sd_imageURL]
diff --git a/Docs/SDWebImage-5.0-Migration-guide.md b/Docs/SDWebImage-5.0-Migration-guide.md index 4ef9cf4c..e684823e 100644 --- a/Docs/SDWebImage-5.0-Migration-guide.md +++ b/Docs/SDWebImage-5.0-Migration-guide.md @@ -38,9 +38,9 @@ In 5.0, we introduced a brand new mechanism for supporting animated images. This This animated image solution is available for `iOS`/`tvOS`/`macOS`. The `SDAnimatedImage` is subclass of `UIImage/NSImage`, and `SDAnimatedImageView` is subclass of `UIImageView/NSImageView`, to make them compatible with the common frameworks APIs. See [Animated Image](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#animated-image-50) for more detailed information. -#### Transformer +#### Image Transformer -In 5.0, we introduced an easy way to hook an image transformation process after the image was downloaded from network. This allows the user to easily scale, rotate, add rounded corner the original image and even chain a list of transformations. These transformed images will also be stored to the cache as they are after transformation. The reasons for this decision are: avoiding redoing the transformations (which can lead to unwanted behavior) and also time saving. See [Image Transformer](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#transformer-50) for more detailed information. +In 5.0, we introduced an easy way to hook an image transformation process after the image was downloaded from network. This allows the user to easily scale, rotate, add rounded corner the original image and even chain a list of transformations. These transformed images will also be stored to the cache as they are after transformation. The reasons for this decision are: avoiding redoing the transformations (which can lead to unwanted behavior) and also time saving. See [Image Transformer](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#image-transformer-50) for more detailed information. #### Customization @@ -58,6 +58,51 @@ In order to clean up things and make our core project do less things, we decided By taking the advantage of the [Custom Loader](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#custom-loader-50) feature, we introduced a plugin to allow easy loading images from the Photos Library. See [SDWebImagePhotosPlugin](https://github.com/SDWebImage/SDWebImagePhotosPlugin) for more detailed information. +### Notable Behavior Changes + +#### Cache + +`SDImageCache` in 5.x, use `~/Library/com.hackemist.SDImageCache.default` as default cache path. However, 4.x use `~/Library/com.hackemist.SDWebImageCache.default`. If you have images in cache, it may be lost during migration. + +If you still want to keep the 4.x default cache path, you can custom the cache path prefix using `namespacePrefix` property. + ++ Objective-C + +```objective-c +SDImageCacheConfig.defaultCacheConfig.namespacePrefix = @"com.hackemist.SDWebImageCache."; +``` + ++ Swift + +```swift +SDImageCacheConfig.`default`.namespacePrefix = "com.hackemist.SDWebImageCache." +``` + +#### Prefetcher + +`SDWebImagePrefetcher` in 5.x, change the concept of fetching batch of URLs. Now, each time you call `prefetchURLs:`, you will get a token which represents the specified URLs list. It does not cancel the previous URLs which is prefetching, which make the shared prefetcher behaves more intuitively. + +However, in 4.x, each time you call `prefetchURLs:`, it will cancel all previous URLs which is been prefetching. + +If you still want the same behavior, manually call `cancelPrefetching` each time before any `prefetchURLs:` calls. + + ++ Objective-C + +```objective-c +SDWebImagePrefetcher *prefetcher = SDWebImagePrefetcher.sharedImagePrefetcher; +[prefetcher cancelPrefetching]; +[prefetcher prefetchURLs:@[url1, url2]]; +``` + ++ Swift + +```swift +let prefetcher = SDWebImagePrefetcher.shared +prefetcher.cancelPrefetching() +prefetcher.prefetchURLs([url1, url2]) +``` + ### API Changes #### SDImageCache @@ -132,8 +177,8 @@ By taking the advantage of the [Custom Loader](https://github.com/rs/SDWebImage/ - `headersFilter` removed, use `requestModifier` instead - `cancel:` removed, use `-[SDWebImageDownloadToken cancel]` instead - `shouldDecompressImages` removed. Use `SDWebImageDownloaderAvoidDecodeImage` in downloader options instead -- use `SDWebImageLoaderProgressBlock` instead of `SDWebImageDownloaderProgressBlock` -- use `SDWebImageLoaderCompletedBlock` instead of `SDWebImageDownloaderCompletedBlock` +- use `SDImageLoaderProgressBlock` instead of `SDWebImageDownloaderProgressBlock` +- use `SDImageLoaderCompletedBlock` instead of `SDWebImageDownloaderCompletedBlock` #### SDWebImageDownloaderOperation @@ -215,5 +260,5 @@ In SDWebImage 5.0 we did a clean up of the API. We are using many modern Objecti - `sd_currentAlternateImageURL()` changed to `sd_currentAlternateImageURL` ### Full API Diff -For advanced user who need the detailed API diff, we provide the full diff in a HTML web page: [SDWebImage 5.0 API Diff](https://raw.githubusercontent.com/rs/SDWebImage/5.x/Docs/API-Diff/5.0/apidiff.html) +For advanced user who need the detailed API diff, we provide the full diff in a HTML web page: [SDWebImage 5.0 API Diff](https://htmlpreview.github.io/?https://github.com/rs/SDWebImage/blob/5.x/Docs/API-Diff/5.0/apidiff.html)
Declaration