Merge pull request #2275 from bpoplauschi/5.x.changelog

5.x CHANGELOG + Migration guide + version update
This commit is contained in:
Bogdan Poplauschi 2018-07-17 10:01:19 +03:00 committed by GitHub
commit af0200fbff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1605 additions and 6 deletions

View File

@ -1,3 +1,57 @@
## [5.0.0 - Release_name_TBD, on Apr xxth, 2018](https://github.com/rs/SDWebImage/releases/tag/5.0.0-beta)
See [all tickets marked for the 5.0.0 release](https://github.com/rs/SDWebImage/milestone/15)
#### Infrastructure
- the new requirements are **iOS 8.0+** and **macOS 10.10+** #2147
- **Xcode 9+**
#### Backwards incompatible changes
See the [5.0 Migration Guide](Docs/SDWebImage-5.0-Migration-guide.md) for a list of comprehensive changes and the way to update your code
#### Features
- Introduce `SDAnimatedImageView`, `SDAnimatedImage` and refactor the way we handle animated images #2140
- Added APNG support via dedicated coder `SDImageAPNGCoder` #2149
- Refactored `SDWebImageDownloader` configs, separated them into a dedicated `SDWebImageDownloaderConfig` object #2263
- Refactored the way we work with the scale factor #2266
- Created request and response modifier #2261
- Refactor Cache Path API #2276
- Refactor custom cache serializer & headers filter for request level #2280
- Refactor cache - Support custom memory cache & disk cache #2282
- Refactor cache - Support custom web cache #2278
- Refactor - custom image loader - Supports loader protocol #2256
- Use `SDWebImageAvoidDecodeImage` to allow user to control force decode feature for individual image request #2283
- `SDImageCache` supports disk cache writing options. See `SDImageCacheConfig diskCacheWritingOptions` #2148
- `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
- 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
- Refactor the implementation of `SDWebImagePrefetcher` so it behaves more like a "shared instance" object, similar to other platform classes. Each instance will manage its own list of urls. #2191 1efc247 92f3d2c bc164d6
- Refactored and enhanced the way we allow image transformations. Switched from a single delegate method to composition of `SDImageTransformer` #2219
- API style refactoring - #2250
- Use property instead of setters and getters to make the property available in Swift
- Use class property with the correct name instead of `+(instanceType)sharedInstance` in singleton to make it more easy to use in Swift. The generated interface should be simple `open class var shared { get }`
- Add all nullability annotation to avoid any `AnyObject!` implicitly unwrapped optionals (Except that `null_resettable`)
- Add all Core Foundation Ownership using `CF_RETURNS_RETAINED` for
Get Rule and `CF_RETURNS_NOT_RETAINED` for Create Rule to avoid any `Unmanaged` CF value
- Change all key for Dictionary with `NS_STRING_ENUM` to make it easy to use in Swift with dot syntax
- Change all global value type which represent enum with `NS_TYPED_ENUM` to make it easy to use in Swift with dot syntax
- Remove the extra calculation of image orientation for ImageIO coder & Fix macOS image orientation #2271
- Added `SDWebImageError` (defined as `NS_ERROR_ENUM`) to group all our errors together #2290
- Added tests for macOS
- Add the `SDWebImageContextStoreCacheType` context option to specify target cache type when the image is downloaded by manager and will store to cache #2360
- Feature watchOS `WKInterfaceImage` with `sd_setImageWithURL` #2331
- Add options to specify query cache sync/async behavior #2312
#### Fixes
- `SDWebImageManager loadImageWithURL:options:progress:completed:` changed the `completed` param requirement from `nullable` to `nonnull` #2164
TODO: Update diagrams
## [4.4.1 - 4.4 patch, on June 7th, 2018](https://github.com/rs/SDWebImage/releases/tag/4.4.1)
See [all tickets marked for the 4.4.1 release](https://github.com/rs/SDWebImage/milestone/26)

View File

@ -0,0 +1,103 @@
body {
font: 12px 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;
margin: 0;
padding: 0 2em 2em 2em;
}
h1 {
margin-top: 30px;
margin-bottom: 30px;
font-size: 28px;
font-weight: bold;
}
.headerFile {
margin-left: 20px;
}
.headerName {
margin: 15px 0px 10px -20px;
padding: 4px 4px 4px 20px;
font-weight: bold;
font-size: 120%;
background-color: #f8f8f8;
}
.differenceGroup {
margin-top: 5px;
}
.difference {
padding-left: 20px;
font-family: Courier, Consolas, monospace;
font-size: 110%;
}
.status {
font-style: italic;
font-size: 80%;
}
.removed {
color: red;
}
.added {
color: blue;
}
.modified {
color: #080;
}
.declaration {
font-family: Courier, Consolas, monospace;
}
table {
border: 1px #888 solid;
padding: 2px;
border-spacing: 0px;
border-collapse: collapse;
margin-left: 40px;
margin-top: 7px;
}
td, th {
font-size: 10px;
border: 1px #888 solid;
padding:3px 6px;
}
th {
font-size: 10px;
text-align: center;
background-color: #eee;
}
td {
font-size: 90%;
text-align: left;
}
ul {
list-style: disc outside;
margin: 0 0 0 16px;
padding: 0;
}
li {
margin-top: 7px;
}
.message {
margin-left: 20px;
font-style: italic;
color: #888;
}
a:link { color: #18396E; text-decoration: none; }
a:active { color: #18396E; text-decoration: none; }
a:visited { color: #003366; text-decoration: none; }
a:link:hover { color: #18396E; text-decoration: underline; }
a:visited:hover { color: #003366; text-decoration: underline; }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,219 @@
## SDWebImage 5.0 Migration Guide
SDWebImage 5.0 is the latest major release of SDWebImage, a top library for downloading and caching images.
As a major release, following [Semantic Versioning](http://semver.org/) conventions, 5.0 introduces several API-breaking changes with its new architecture.
This guide is provided in order to ease the transition of existing applications using SDWebImage 4.X to the latest APIs, as well as explain the design and structure of new and changed functionality.
### Requirements: iOS 8, Mac OS X 10.10, watchOS 2, tvOS 9, Xcode 9
SDWebImage 5.0 officially supports iOS 8 and later, Mac OS X 10.10 and later, watchOS 2 and later and tvOS 9 and later.
It needs Xcode 9 or later to be able to build everything properly.
For targeting previous versions of the SDKs, check [README - Backwards compatibility](https://github.com/rs/SDWebImage#backwards-compatibility).
### Migration
Using the view categories brings no change from 4.x to 5.0.
Objective-C:
```objective-c
[imageView sd_setImageWithURL:url placeholderImage:placeholderImage];
```
Swift:
```swift
imageView.sd_setImage(with: url, placeholderImage: placeholder)
```
However, all view categories in 5.0 introduce a new extra arg called `SDWebImageContext`. This param can hold anything, as oposed to the previous `SDWebImageOptions` enum limitations. This gives developers advanced control for the behavior of image loading (cache, loader, etc). See the declaration for `SDWebImageContext` for detailed information.
### New Feature
#### Animated Image View
In 5.0, we introduced a brand new mechanism for supporting animated images. This includes animated image loading, rendering, decoding, and also supports customizations (for advanced users).
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
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.
#### Customization
In 5.0, we refactored our framework architecture in many aspects. This makes our framework easier to customize for advanced users, without the need for hooking anything or forking. We introduced [Custom Cache](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#custom-cache-50) to control detailed cache loading behavior, and separate the memory cache & disk cache implementation. We introduced [Custom Loader](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#custom-loader-50) to allow custom loading from your own source (doesn't have to be the network). And also, we changed the current [Custom Coder](https://github.com/rs/SDWebImage/wiki/Advanced-Usage#custom-coder-420) to work better for custom image decoder/encoder and animated images.
#### View Indicator
In 5.0, we refactored the image loading indicator API into a better and extensible API for `iOS`/`tvOS`/`macOS`. This is suitable for easy usage like providing a loading view during the image loading process. See [View Indicator](https://github.com/rs/SDWebImage/wiki/How-to-use#use-view-indicator-50) for more detailed information.
#### FLAnimatedImage support moved to a dedicated plugin repo
In order to clean up things and make our core project do less things, we decided that the `FLAnimatedImage` integration does not belong here. From 5.0, this will still be available, but under a dedicated repo [SDWebImageFLPlugin](https://github.com/SDWebImage/SDWebImageFLPlugin).
#### Photos Plugin
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.
### API Changes
#### SDImageCache
- moved `maxMemoryCost` and `maxMemoryCountLimit` to `SDImageCacheConfig`
- `makeDiskCachePath:` removed, use `NSSearchPathForDirectoriesInDomains` with NSString's Path API instead.
- `addReadOnlyCachePath:` removed, use `additionalCachePathBlock` instead
- `cachePathForKey:inPath:` removed, use `cachePathForKey:` with NSString's path API instead.
- `defaultCachePathForKey:` removed, use `cachePathForKey:` instead
- `SDCacheQueryCompletedBlock` renamed to `SDImageCacheQueryCompletionBlock`
- `SDWebImageCheckCacheCompletionBlock` renamed to `SDImageCacheCheckCompletionBlock`
- `SDWebImageCalculateSizeBlock` renamed to `SDImageCacheCalculateSizeBlock`
#### SDImageCacheConfig
- `shouldDecompressImages` removed. Use `SDImageCacheAvoidDecodeImage` in cache options instead
#### SDWebImageManager
- `loadImageWithURL:options:progress:completed:` changed the `completed` param requirement from `nullable` to `nonnull`
- `loadImageWithURL:options:progress:completed:` return type `id<SDWebImageOperation>` changed to `SDWebImageCombinedOperation *`
- `imageCache` changed from nullable to nonnull. And property type changed from `SDImageCache *` to `id<SDImageCache>`. The default value does not change.
- `imageDownloader` renamed to `imageLoader` and changed from nullable to nonnull. And property type changed from `SDWebImageDownloader *` to `id<SDImageLoader>`. The default value does not change.
- `cacheKeyFilter` property type changed to `id<SDWebImageCacheKeyFilter>`, you can use `+[SDWebImageCacheKeyFilter cacheKeyFilterWithBlock:]` to create
- `cacheSerializer` property type changed to `id<SDWebImageCacheSerializer>`, you can use `+[SDWebImageCacheSerializer cacheSerializerWithBlock:]` to create
- `SDWebImageCacheKeyFilterBlock`'s `url` arg change from nullable to nonnull
- `initWithCache:downloader:` 's `cache` arg type changed from `SDImageCache *` to `id<SDImageCache>`
- `initWithCache:downloader` renamed to `initWithCache:loader:`
- `saveImageToCache:forURL:` removed. Use `SDImageCache storeImage:imageData:forKey:cacheType:completion:` (or `SDImageCache storeImage:forKey:toDisk:completion:` if you use default cache class) with `cacheKeyForURL:` instead.
- `diskImageExistsForURL:completion:` removed. Use `SDImageCache containsImageForKey:cacheType:completion:` (or `SDImageCache diskImageExistsWithKey:completion:` if you use default cache class) with `cacheKeyForURL:` instead.
- `cachedImageExistsForURL:completion` removed. Use `SDImageCache containsImageForKey:cacheType:completion:` (or `SDImageCache diskImageExistsWithKey:completion:` and `SDImageCache imageFromMemoryCacheForKey:` if you use default cache class) with `cacheKeyForURL:` instead.
#### SDWebImageManagerDelegate
- removed `imageManager:transformDownloadedImage:forKey:`, use `SDImageTransformer` with context option instead
#### UIView and subclasses (UIImageView, UIButton, ...)
- `sd_internalSetImageWithURL:placeholderImage:options:operationKey:setImageBlock:progress:completed:` renamed to `UIView sd_internalSetImageWithURL:placeholderImage:options:context:setImageBlock:progress:completed:` (The biggest changes is that the completion block type from `SDExternalCompletionBlock` to `SDInternalCompletionBlock`. Which allow advanced user to get more information of image loading process)
- `sd_internalSetImageWithURL:placeholderImage:options:operationKey:setImageBlock:progress:completed:context:` removed
- activity indicator refactoring - use `sd_imageIndicator` with `SDWebImageActivityIndicator`
- `sd_setShowActivityIndicatorView:` removed
- `sd_setIndicatorStyle:` removed
- `sd_showActivityIndicatorView` removed
- `sd_addActivityIndicator:` removed
- `sd_removeActivityIndicator:` removed
#### UIImage
- Renamed `isGIF` to `sd_isAnimated`, also `NSImage isGIF` renamed to `NSImage sd_isAnimated`
- Renamed `decodedImageWithImage:` to `sd_decodedImageWithImage:`
- Renamed `decodedAndScaledDownImageWithImage:` to `sd_decodedAndScaledDownImageWithImage:`
- Renamed `sd_animatedGIFWithData` to `sd_imageWithGIFData:`
- Removed `sd_webpLoopCount`
#### UIImageView
- Removed `sd_setImageWithPreviousCachedImageWithURL:placeholderImage:options:progress:completed`
#### SDWebImageDownloader
- `shouldDecompressImages` moved to `SDWebImageDownloaderConfig.shouldDecompressImages`
- `maxConcurrentDownloads` moved to `SDWebImageDownloaderConfig.maxConcurrentDownloads`
- `downloadTimeout` moved to `SDWebImageDownloaderConfig.downloadTimeout`
- `operationClass` moved to `SDWebImageDownloaderConfig.operationClass`
- `executionOrder` moved to `SDWebImageDownloaderConfig.executionOrder`
- `urlCredential` moved to `SDWebImageDownloaderConfig.urlCredential`
- `username` moved to `SDWebImageDownloaderConfig.username`
- `password` moved to `SDWebImageDownloaderConfig.password`
- `initWithSessionConfiguration:` removed, use `initWithConfig:` with session configuration instead
- `createNewSessionWithConfiguration:` removed, use `initWithConfig:` with new session configuration instead. To modify shared downloader configuration, provide custom `SDWebImageDownloaderConfig.defaultDownloaderConfig` before it created.
- `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`
#### SDWebImageDownloaderOperation
- `initWithRequest:inSession:options:context:` is now the designated initializer
- Removed `shouldUseCredentialStorage` property
- `SDWebImageDownloadOperationInterface` protocol renamed to `SDWebImageDownloadOperation`
- `expectedSize` removed, use `response.expectedContentLength` instead
- `shouldDecompressImages` removed. Use `SDWebImageDownloaderAvoidDecodeImage` in downloader options instead.
- `response` property change to readonly
#### SDWebImagePrefetcher
- `prefetchURLs:` and `prefetchURLs:progress:completed:` return types changed from `void` to `SDWebImagePrefetchToken`
- `prefetcherQueue` property renamed to `delegateQueue`
- `maxConcurrentDownloads` property removed, use `SDWebImageManager.downloader` config instead
#### SDImageCoder
- `SDCGColorSpaceGetDeviceRGB()` moved to `+[SDImageCoderHelper colorSpaceGetDeviceRGB]`
- `SDCGImageRefContainsAlpha()`, moved to `+[SDImageCoderHelper imageRefContainsAlpha:]`
- `decodedImageWithData:` replaced with `decodedImageWithData:options:`
- `encodedDataWithImage:format:` replaced with `encodedDataWithImage:format:options`
- `init` method from `SDWebImageProgressiveCoder` changed to `initIncrementalWithOptions:`
- `incrementalDecodedImageWithData:finished` replaced with `updateIncrementalData:finished` and `incrementalDecodedImageWithOptions:` two APIs
- removed `decompressedImage:data:options`, use `+[SDImageCoderHelper decodedImageWithImage:]` and `+[SDImageCoderHelper decodedAndScaledDownImageWithImage:limitBytes:]` instead
#### Constants
- `SDWebImageInternalSetImageGroupKey` renamed to `SDWebImageContextSetImageGroup`
- `SDWebImageExternalCustomManagerKey` renamed to `SDWebImageContextCustomManager`
#### Swift Specific API Change
In SDWebImage 5.0 we did a clean up of the API. We are using many modern Objective-C declarations to generate the Swift API. We now provide full nullability support, string enum, class property, and even custom Swift API name, all to make the framework easier to use for our Swift users. Here are the API change specify for Swift.
##### UIView+WebCache
- `sd_imageURL()` changed to `sd_imageURL`
##### SDImageCache
- `shared()` changed to `shared`
##### SDWebImageManager
- `shared()` changed to `shared`
- `isRunning()` changed to `isRunning`
##### SDWebImageDownloader
- `shared()` changed to `shared`
- `setOperationClass(_:)` available for Swift user with `operationClass` property
- `setSuspended(_:)` changed to `isSuspended` property
##### SDWebImageDownloadOperation
- `SDWebImageDownloadOperationInterface` protocol renamed to `SDWebImageDownloadOperationProtocol`.
##### SDImageCodersManager
- `sharedInstance()` changed to `shared`
##### SDImageIOCoder
- `shared()` changed to `shared`
##### SDImageGIFCoder
- `shared()` changed to `shared`
##### SDImageWebPCoder
- `shared()` changed to `shared`
##### NSData-ImageContentType
- `sd_UTTypeFromSDImageFormat` return `CFString` instead of `Unmanaged<CFString>`
##### UIButton-WebCache
- `sd_currentImageURL()` changed to `sd_currentImageURL`
##### NSButton-WebCache
- `sd_currentImageURL()` changed to `sd_currentImageURL`
- `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/master/Docs/Diff/5.0/apidiff.html)

View File

@ -20261,7 +20261,7 @@
"_parent": {
"$ref": "AAAAAAFUkhyNUo23oFw="
},
"name": "SDWebImageProgressiveDownload",
"name": "SDWebImageProgressiveLoad",
"visibility": "public"
},
{
@ -22759,4 +22759,4 @@
"visibility": "public"
}
]
}
}

View File

@ -41,7 +41,7 @@ This library provides an async image downloader with cache support. For convenie
#### Backwards compatibility
- For iOS 7 and macOS 10.9, use [any 4.x version up to 4.3.3](https://github.com/rs/SDWebImage/releases/tag/4.3.3)
- For iOS 7, macOS 10.9 or Xcode < 8, use [any 4.x version up to 4.3.3](https://github.com/rs/SDWebImage/releases/tag/4.3.3)
- For macOS 10.8, use [any 4.x version up to 4.3.0](https://github.com/rs/SDWebImage/releases/tag/4.3.0)
- For iOS 5 and 6, use [any 3.x version up to 3.7.6](https://github.com/rs/SDWebImage/tag/3.7.6)
- For iOS < 5.0, please use the last [2.0 version](https://github.com/rs/SDWebImage/tree/2.0-compat).
@ -53,6 +53,7 @@ This library provides an async image downloader with cache support. For convenie
- Read the [Documentation @ CocoaDocs](http://cocoadocs.org/docsets/SDWebImage/)
- Try the example by downloading the project from Github or even easier using CocoaPods try `pod try SDWebImage`
- Read the [Installation Guide](https://github.com/rs/SDWebImage/wiki/Installation-Guide)
- Read the [SDWebImage 5.0 Migration Guide](Docs/SDWebImage-5.0-Migration-guide.md) to get an idea of the changes from 4.x to 5.x
- Read the [SDWebImage 4.0 Migration Guide](Docs/SDWebImage-4.0-Migration-guide.md) to get an idea of the changes from 3.x to 4.x
- Read the [Common Problems](https://github.com/rs/SDWebImage/wiki/Common-Problems) to find the solution for common problems
- Go to the [Wiki Page](https://github.com/rs/SDWebImage/wiki) for more information such as [Advanced Usage](https://github.com/rs/SDWebImage/wiki/Advanced-Usage)

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SDWebImage'
s.version = '4.4.1'
s.version = '5.0.0-beta'
s.osx.deployment_target = '10.10'
s.ios.deployment_target = '8.0'

View File

@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.4.1</string>
<string>5.0.0-beta</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4.4.1</string>
<string>5.0.0-beta</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>