Fixing Typos throughout project
This commit is contained in:
parent
ab80a9e3d1
commit
05bd44e56e
|
@ -28,7 +28,7 @@ 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.
|
||||
However, all view categories in 5.0 introduce a new extra arg called `SDWebImageContext`. This param can hold anything, as opposed 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
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ static const SDImageFormat SDImageFormatSVG = 8;
|
|||
+ (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED NS_SWIFT_NAME(sd_UTType(from:));
|
||||
|
||||
/**
|
||||
* Convert UTTyppe to SDImageFormat
|
||||
* Convert UTType to SDImageFormat
|
||||
*
|
||||
* @param uttype The UTType as CFStringRef
|
||||
* @return The Format as SDImageFormat
|
||||
|
|
|
@ -101,11 +101,11 @@
|
|||
The scale factor of the image.
|
||||
|
||||
@note For UIKit, this just call super instead.
|
||||
@note For AppKit, `NSImage` can contains multiple image representations with different scales. However, this class does not do that from the design. We processs the scale like UIKit. This wil actually be calculated from image size and pixel size.
|
||||
@note For AppKit, `NSImage` can contains multiple image representations with different scales. However, this class does not do that from the design. We process the scale like UIKit. This will actually be calculated from image size and pixel size.
|
||||
*/
|
||||
@property (nonatomic, readonly) CGFloat scale;
|
||||
|
||||
// By default, animated image frames are returned by decoding just in time without keeping into memory. But you can choose to preload them into memory as well, See the decsription in `SDAnimatedImage` protocol.
|
||||
// By default, animated image frames are returned by decoding just in time without keeping into memory. But you can choose to preload them into memory as well, See the description in `SDAnimatedImage` protocol.
|
||||
// After preloaded, there is no huge difference on performance between this and UIImage's `animatedImageWithImages:duration:`. But UIImage's animation have some issues such like blanking and pausing during segue when using in `UIImageView`. It's recommend to use only if need.
|
||||
- (void)preloadAllFrames;
|
||||
- (void)unloadAllFrames;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/// Current loop count since its latest animating. This value is KVO Compliance.
|
||||
@property (nonatomic, readonly) NSUInteger currentLoopCount;
|
||||
|
||||
/// Total frame count for niamted image rendering. Defaults is animated image's frame count.
|
||||
/// Total frame count for animated image rendering. Defaults is animated image's frame count.
|
||||
/// @note For progressive animation, you can update this value when your provider receive more frames.
|
||||
@property (nonatomic, assign) NSUInteger totalFrameCount;
|
||||
|
||||
|
@ -49,13 +49,13 @@
|
|||
|
||||
/// Create a player with animated image provider. If the provider's `animatedImageFrameCount` is less than 1, returns nil.
|
||||
/// The provider can be any protocol implementation, like `SDAnimatedImage`, `SDImageGIFCoder`, etc.
|
||||
/// @note This provider can represent mutable content, like prorgessive animated loading. But you need to update the frame count by yourself
|
||||
/// @note This provider can represent mutable content, like progressive animated loading. But you need to update the frame count by yourself
|
||||
/// @param provider The animated provider
|
||||
- (nullable instancetype)initWithProvider:(nonnull id<SDAnimatedImageProvider>)provider;
|
||||
|
||||
/// Create a player with animated image provider. If the provider's `animatedImageFrameCount` is less than 1, returns nil.
|
||||
/// The provider can be any protocol implementation, like `SDAnimatedImage` or `SDImageGIFCoder`, etc.
|
||||
/// @note This provider can represent mutable content, like prorgessive animated loading. But you need to update the frame count by yourself
|
||||
/// @note This provider can represent mutable content, like progressive animated loading. But you need to update the frame count by yourself
|
||||
/// @param provider The animated provider
|
||||
+ (nullable instancetype)playerWithProvider:(nonnull id<SDAnimatedImageProvider>)provider;
|
||||
|
||||
|
@ -65,13 +65,13 @@
|
|||
/// The handler block when one loop count finished.
|
||||
@property (nonatomic, copy, nullable) void (^animationLoopHandler)(NSUInteger loopCount);
|
||||
|
||||
/// Return the status whehther animation is playing.
|
||||
/// Return the status whether animation is playing.
|
||||
@property (nonatomic, readonly) BOOL isPlaying;
|
||||
|
||||
/// Start the animation. Or resume the previously paused animation.
|
||||
- (void)startPlaying;
|
||||
|
||||
/// Pause the aniamtion. Keep the current frame index and loop count.
|
||||
/// Pause the animation. Keep the current frame index and loop count.
|
||||
- (void)pausePlaying;
|
||||
|
||||
/// Stop the animation. Reset the current frame index and loop count.
|
||||
|
@ -83,7 +83,7 @@
|
|||
/// @param loopCount The loop count
|
||||
- (void)seekToFrameAtIndex:(NSUInteger)index loopCount:(NSUInteger)loopCount;
|
||||
|
||||
/// Clear the frame cache buffer. The frame cache buffer size can be controled by `maxBufferSize`.
|
||||
/// Clear the frame cache buffer. The frame cache buffer size can be controlled by `maxBufferSize`.
|
||||
/// By default, when stop or pause the animation, the frame buffer is still kept to ready for the next restart
|
||||
- (void)clearFrameBuffer;
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Otherwise, we shoudle be ready to display next frame
|
||||
// Otherwise, we should be ready to display next frame
|
||||
self.needsDisplayWhenImageBecomesAvailable = YES;
|
||||
self.currentFrameIndex = nextFrameIndex;
|
||||
self.currentTime -= currentDuration;
|
||||
|
@ -299,7 +299,7 @@
|
|||
if (nextFrameIndex == 0) {
|
||||
// Update the loop count
|
||||
self.currentLoopCount++;
|
||||
[self handleLoopChnage];
|
||||
[self handleLoopChange];
|
||||
|
||||
// if reached the max loop count, stop animating, 0 means loop indefinitely
|
||||
NSUInteger maxLoopCount = self.totalLoopCount;
|
||||
|
@ -352,7 +352,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)handleLoopChnage {
|
||||
- (void)handleLoopChange {
|
||||
if (self.animationLoopHandler) {
|
||||
self.animationLoopHandler(self.currentLoopCount);
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
// `NSBitmapImageRep`'s `imageRepWithData:` is not designed initlizer
|
||||
// `NSBitmapImageRep`'s `imageRepWithData:` is not designed initializer
|
||||
+ (instancetype)imageRepWithData:(NSData *)data {
|
||||
SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data];
|
||||
return imageRep;
|
||||
}
|
||||
|
||||
// We should override init method for `NSBitmapImageRep` to do initlize about animated image format
|
||||
// We should override init method for `NSBitmapImageRep` to do initialize about animated image format
|
||||
- (instancetype)initWithData:(NSData *)data {
|
||||
self = [super initWithData:data];
|
||||
if (self) {
|
||||
|
@ -58,14 +58,14 @@
|
|||
[self setProperty:NSImageLoopCount withValue:@(loopCount)];
|
||||
} else if (CFStringCompare(type, kUTTypePNG, 0) == kCFCompareEqualTo) {
|
||||
// APNG
|
||||
// Do initilize about frame count, current frame/duration and loop count
|
||||
// Do initialize about frame count, current frame/duration and loop count
|
||||
[self setProperty:NSImageFrameCount withValue:@(frameCount)];
|
||||
[self setProperty:NSImageCurrentFrame withValue:@(0)];
|
||||
NSUInteger loopCount = [SDImageAPNGCoder imageLoopCountWithSource:imageSource];
|
||||
[self setProperty:NSImageLoopCount withValue:@(loopCount)];
|
||||
} else if (CFStringCompare(type, kSDUTTypeHEICS, 0) == kCFCompareEqualTo) {
|
||||
// HEIC
|
||||
// Do initilize about frame count, current frame/duration and loop count
|
||||
// Do initialize about frame count, current frame/duration and loop count
|
||||
[self setProperty:NSImageFrameCount withValue:@(frameCount)];
|
||||
[self setProperty:NSImageCurrentFrame withValue:@(0)];
|
||||
NSUInteger loopCount = [SDImageHEICCoder imageLoopCountWithSource:imageSource];
|
||||
|
|
|
@ -135,7 +135,7 @@
|
|||
} else {
|
||||
provider = (id<SDAnimatedImage>)image;
|
||||
}
|
||||
// Create animted player
|
||||
// Create animated player
|
||||
self.player = [SDAnimatedImagePlayer playerWithProvider:provider];
|
||||
} else {
|
||||
// Update Frame Count
|
||||
|
|
|
@ -86,7 +86,7 @@ static NSString * const SDDiskCacheExtendedAttributeName = @"com.hackemist.SDDis
|
|||
|
||||
// get cache Path for image key
|
||||
NSString *cachePathForKey = [self cachePathForKey:key];
|
||||
// transform to NSUrl
|
||||
// transform to NSURL
|
||||
NSURL *fileURL = [NSURL fileURLWithPath:cachePathForKey];
|
||||
|
||||
[data writeToURL:fileURL options:self.config.diskCacheWritingOptions error:nil];
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#import <MobileCoreServices/MobileCoreServices.h>
|
||||
#endif
|
||||
|
||||
// iOS 8 Image/IO framework binary does not contains these APNG contants, so we define them. Thanks Apple :)
|
||||
// iOS 8 Image/IO framework binary does not contains these APNG constants, so we define them. Thanks Apple :)
|
||||
// We can not use runtime @available check for this issue, because it's a global symbol and should be loaded during launch time by dyld. So hack if the min deployment target version < iOS 9.0, whatever it running on iOS 9+ or not.
|
||||
#if (__IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
|
||||
const CFStringRef kCGImagePropertyAPNGLoopCount = (__bridge CFStringRef)@"LoopCount";
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {
|
|||
*/
|
||||
SDImageCacheAvoidDecodeImage = 1 << 4,
|
||||
/**
|
||||
* By default, we decode the animated image. This flag can force decode the first frame only and produece the static image.
|
||||
* By default, we decode the animated image. This flag can force decode the first frame only and produce the static image.
|
||||
*/
|
||||
SDImageCacheDecodeFirstFrameOnly = 1 << 5,
|
||||
/**
|
||||
|
@ -49,7 +49,7 @@ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {
|
|||
SDImageCachePreloadAllFrames = 1 << 6,
|
||||
/**
|
||||
* By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available, to behave as a fallback solution.
|
||||
* Using this option, can ensure we always produce image with your provided class. If failed, a error with code `SDWebImageErrorBadImageData` will been used.
|
||||
* Using this option, can ensure we always produce image with your provided class. If failed, an error with code `SDWebImageErrorBadImageData` will be used.
|
||||
* Note this options is not compatible with `SDImageCacheDecodeFirstFrameOnly`, which always produce a UIImage/NSImage.
|
||||
*/
|
||||
SDImageCacheMatchAnimatedImageClass = 1 << 7,
|
||||
|
@ -65,7 +65,7 @@ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {
|
|||
|
||||
/**
|
||||
* Cache Config object - storing all kind of settings.
|
||||
* The property is copy so change of currrent config will not accidentally affect other cache's config.
|
||||
* The property is copy so change of current config will not accidentally affect other cache's config.
|
||||
*/
|
||||
@property (nonatomic, copy, nonnull, readonly) SDImageCacheConfig *config;
|
||||
|
||||
|
@ -282,7 +282,7 @@ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {
|
|||
* @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`.
|
||||
* @param options A mask to specify options to use for this cache query
|
||||
* @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
|
||||
* @param queryCacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediatelly.
|
||||
* @param queryCacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediately.
|
||||
* @param doneBlock The completion block. Will not get called if the operation is cancelled
|
||||
*
|
||||
* @return a NSOperation instance containing the cache op
|
||||
|
|
|
@ -604,7 +604,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
// Make sure to call form io queue by caller
|
||||
// Make sure to call from io queue by caller
|
||||
- (void)_removeImageFromDiskForKey:(NSString *)key {
|
||||
if (!key) {
|
||||
return;
|
||||
|
|
|
@ -57,7 +57,7 @@ typedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) {
|
|||
/*
|
||||
* The option to control weak memory cache for images. When enable, `SDImageCache`'s memory cache will use a weak maptable to store the image at the same time when it stored to memory, and get removed at the same time.
|
||||
* However when memory warning is triggered, since the weak maptable does not hold a strong reference to image instance, even when the memory cache itself is purged, some images which are held strongly by UIImageViews or other live instances can be recovered again, to avoid later re-query from disk cache or network. This may be helpful for the case, for example, when app enter background and memory is purged, cause cell flashing after re-enter foreground.
|
||||
* Defautls to YES. You can change this option dynamically.
|
||||
* Defaults to YES. You can change this option dynamically.
|
||||
*/
|
||||
@property (assign, nonatomic) BOOL shouldUseWeakMemoryCache;
|
||||
|
||||
|
@ -115,7 +115,7 @@ typedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) {
|
|||
/**
|
||||
* The custom file manager for disk cache. Pass nil to let disk cache choose the proper file manager.
|
||||
* Defaults to nil.
|
||||
* @note This value does not support dynamic changes. Which means further modification on this value after cache initlized has no effect.
|
||||
* @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect.
|
||||
* @note Since `NSFileManager` does not support `NSCopying`. We just pass this by reference during copying. So it's not recommend to set this value on `defaultCacheConfig`.
|
||||
*/
|
||||
@property (strong, nonatomic, nullable) NSFileManager *fileManager;
|
||||
|
@ -123,14 +123,14 @@ typedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) {
|
|||
/**
|
||||
* The custom memory cache class. Provided class instance must conform to `SDMemoryCache` protocol to allow usage.
|
||||
* Defaults to built-in `SDMemoryCache` class.
|
||||
* @note This value does not support dynamic changes. Which means further modification on this value after cache initlized has no effect.
|
||||
* @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect.
|
||||
*/
|
||||
@property (assign, nonatomic, nonnull) Class memoryCacheClass;
|
||||
|
||||
/**
|
||||
* The custom disk cache class. Provided class instance must conform to `SDDiskCache` protocol to allow usage.
|
||||
* Defaults to built-in `SDDiskCache` class.
|
||||
* @note This value does not support dynamic changes. Which means further modification on this value after cache initlized has no effect.
|
||||
* @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect.
|
||||
*/
|
||||
@property (assign ,nonatomic, nonnull) Class diskCacheClass;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ FOUNDATION_EXPORT UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonn
|
|||
@required
|
||||
/**
|
||||
Query the cached image from image cache for given key. The operation can be used to cancel the query.
|
||||
If image is cached in memory, completion is called synchronously, else aynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`)
|
||||
If image is cached in memory, completion is called synchronously, else asynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`)
|
||||
|
||||
@param key The image cache key
|
||||
@param options A mask to specify options to use for this query
|
||||
|
@ -79,12 +79,12 @@ FOUNDATION_EXPORT UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonn
|
|||
|
||||
/**
|
||||
Query the cached image from image cache for given key. The operation can be used to cancel the query.
|
||||
If image is cached in memory, completion is called synchronously, else aynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`)
|
||||
If image is cached in memory, completion is called synchronously, else asynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`)
|
||||
|
||||
@param key The image cache key
|
||||
@param options A mask to specify options to use for this query
|
||||
@param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.
|
||||
@param cacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediatelly.
|
||||
@param cacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediately.
|
||||
@param completionBlock The completion block. Will not get called if the operation is cancelled
|
||||
@return The operation for this query
|
||||
*/
|
||||
|
@ -95,7 +95,7 @@ FOUNDATION_EXPORT UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonn
|
|||
completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock;
|
||||
|
||||
/**
|
||||
Store the image into image cache for the given key. If cache type is memory only, completion is called synchronously, else aynchronously.
|
||||
Store the image into image cache for the given key. If cache type is memory only, completion is called synchronously, else asynchronously.
|
||||
|
||||
@param image The image to store
|
||||
@param imageData The image data to be used for disk storage
|
||||
|
@ -110,7 +110,7 @@ FOUNDATION_EXPORT UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonn
|
|||
completion:(nullable SDWebImageNoParamsBlock)completionBlock;
|
||||
|
||||
/**
|
||||
Remove the image from image cache for the given key. If cache type is memory only, completion is called synchronously, else aynchronously.
|
||||
Remove the image from image cache for the given key. If cache type is memory only, completion is called synchronously, else asynchronously.
|
||||
|
||||
@param key The image cache key
|
||||
@param cacheType The image remove op cache type
|
||||
|
@ -121,7 +121,7 @@ FOUNDATION_EXPORT UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonn
|
|||
completion:(nullable SDWebImageNoParamsBlock)completionBlock;
|
||||
|
||||
/**
|
||||
Check if image cache contains the image for the given key (does not load the image). If image is cached in memory, completion is called synchronously, else aynchronously.
|
||||
Check if image cache contains the image for the given key (does not load the image). If image is cached in memory, completion is called synchronously, else asynchronously.
|
||||
|
||||
@param key The image cache key
|
||||
@param cacheType The image contains op cache type
|
||||
|
@ -132,7 +132,7 @@ FOUNDATION_EXPORT UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonn
|
|||
completion:(nullable SDImageCacheContainsCompletionBlock)completionBlock;
|
||||
|
||||
/**
|
||||
Clear all the cached images for image cache. If cache type is memory only, completion is called synchronously, else aynchronously.
|
||||
Clear all the cached images for image cache. If cache type is memory only, completion is called synchronously, else asynchronously.
|
||||
|
||||
@param cacheType The image clear op cache type
|
||||
@param completionBlock A block executed after the operation is finished
|
||||
|
|
|
@ -67,14 +67,14 @@ FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeBackground
|
|||
A CGSize value indicating the max image resolution in pixels during encoding. For vector image, this also effect the output vector data information about width and height. The encoder will not generate the encoded image larger than this limit. Note it always use the aspect ratio of input image..
|
||||
Defaults to CGSizeZero, which means no max size limit at all.
|
||||
@note Supports for animated image as well.
|
||||
@note The ouput image's width is limited to pixel size's width, the output image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both.
|
||||
@note The output image's width is limited to pixel size's width, the output image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both.
|
||||
@note works for `SDImageCoder`
|
||||
*/
|
||||
FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeMaxPixelSize;
|
||||
|
||||
/**
|
||||
A NSUInteger value specify the max ouput data bytes size after encoding. Some lossy format like JPEG/HEIF supports the hint for codec to automatically reduce the quality and match the file size you want. Note this option will override the `SDImageCoderEncodeCompressionQuality`, because now the quality is decided by the encoder. (NSNumber)
|
||||
@note This is a hint, no gurantee for output size because of compression algorithm limit. And this options does not works for vector images.
|
||||
A NSUInteger value specify the max output data bytes size after encoding. Some lossy format like JPEG/HEIF supports the hint for codec to automatically reduce the quality and match the file size you want. Note this option will override the `SDImageCoderEncodeCompressionQuality`, because now the quality is decided by the encoder. (NSNumber)
|
||||
@note This is a hint, no guarantee for output size because of compression algorithm limit. And this options does not works for vector images.
|
||||
@note works for `SDImageCoder`
|
||||
*/
|
||||
FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeMaxFileSize;
|
||||
|
@ -90,7 +90,7 @@ FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeEmbedThumb
|
|||
/**
|
||||
A SDWebImageContext object which hold the original context options from top-level API. (SDWebImageContext)
|
||||
This option is ignored for all built-in coders and take no effect.
|
||||
But this may be useful for some custom coders, because some business logic may dependent on things other than image or image data inforamtion only.
|
||||
But this may be useful for some custom coders, because some business logic may dependent on things other than image or image data information only.
|
||||
See `SDWebImageContext` for more detailed information.
|
||||
*/
|
||||
FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderWebImageContext API_DEPRECATED("The coder component will be seperated from Core subspec in the future. Update your code to not rely on this context option.", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED));;
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
+ (UIImage * _Nullable)decodedAndScaledDownImageWithImage:(UIImage * _Nullable)image limitBytes:(NSUInteger)bytes;
|
||||
|
||||
/**
|
||||
Control the default limit bytes to scale down larget images.
|
||||
Control the default limit bytes to scale down largest images.
|
||||
This value must be larger than or equal to 1MB. Defaults to 60MB on iOS/tvOS, 90MB on macOS, 30MB on watchOS.
|
||||
*/
|
||||
@property (class, readwrite) NSUInteger defaultScaleDownLimitBytes;
|
||||
|
|
|
@ -406,13 +406,13 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
|||
CGContextSetInterpolationQuality(destContext, kCGInterpolationHigh);
|
||||
|
||||
// Now define the size of the rectangle to be used for the
|
||||
// incremental blits from the input image to the output image.
|
||||
// incremental bits from the input image to the output image.
|
||||
// we use a source tile width equal to the width of the source
|
||||
// image due to the way that iOS retrieves image data from disk.
|
||||
// iOS must decode an image from disk in full width 'bands', even
|
||||
// if current graphics context is clipped to a subrect within that
|
||||
// band. Therefore we fully utilize all of the pixel data that results
|
||||
// from a decoding opertion by achnoring our tile size to the full
|
||||
// from a decoding operation by anchoring our tile size to the full
|
||||
// width of the input image.
|
||||
CGRect sourceTile = CGRectZero;
|
||||
sourceTile.size.width = sourceResolution.width;
|
||||
|
@ -428,7 +428,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
|||
destTile.size.height = sourceTile.size.height * imageScale;
|
||||
destTile.origin.x = 0.0f;
|
||||
// The source seem overlap is proportionate to the destination seem overlap.
|
||||
// this is the amount of pixels to overlap each tile as we assemble the ouput image.
|
||||
// this is the amount of pixels to overlap each tile as we assemble the output image.
|
||||
float sourceSeemOverlap = (int)((kDestSeemOverlap/destResolution.height)*sourceResolution.height);
|
||||
CGImageRef sourceTileImageRef;
|
||||
// calculate the number of read/write operations required to assemble the
|
||||
|
@ -561,7 +561,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
|||
}
|
||||
#endif
|
||||
|
||||
#pragma mark - Helper Fuction
|
||||
#pragma mark - Helper Function
|
||||
+ (BOOL)shouldDecodeImage:(nullable UIImage *)image {
|
||||
// Prevent "CGBitmapContextCreateImage: invalid context 0x0" error
|
||||
if (image == nil) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#import "SDImageHEICCoder.h"
|
||||
#import "SDImageHEICCoderInternal.h"
|
||||
|
||||
// These constantce are available from iOS 13+ and Xcode 11. This raw value is used for toolchain and firmware compatiblitiy
|
||||
// These constants are available from iOS 13+ and Xcode 11. This raw value is used for toolchain and firmware compatibility
|
||||
static NSString * kSDCGImagePropertyHEICSDictionary = @"{HEICS}";
|
||||
static NSString * kSDCGImagePropertyHEICSLoopCount = @"LoopCount";
|
||||
static NSString * kSDCGImagePropertyHEICSDelayTime = @"DelayTime";
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
/**
|
||||
This is the abstract class for all animated coder, which use the Image/IO API. You can not use this directly as real coders. A exception will be raised if you use this class.
|
||||
All of the properties need the subclass to implment and works as expceted.
|
||||
All of the properties need the subclass to implement and works as expected.
|
||||
For Image/IO, See Apple's documentation: https://developer.apple.com/documentation/imageio
|
||||
*/
|
||||
@interface SDImageIOAnimatedCoder : NSObject <SDProgressiveImageCoder, SDAnimatedImageCoder>
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
@property (class, readonly, nonnull) NSString *dictionaryProperty;
|
||||
/**
|
||||
The image unclamped deply time property key used in Image/IO API. Such as `kCGImagePropertyGIFUnclampedDelayTime`
|
||||
The image unclamped delay time property key used in Image/IO API. Such as `kCGImagePropertyGIFUnclampedDelayTime`
|
||||
@note Subclass override.
|
||||
*/
|
||||
@property (class, readonly, nonnull) NSString *unclampedDelayTimeProperty;
|
||||
|
|
|
@ -18,7 +18,7 @@ typedef void(^SDImageLoaderCompletedBlock)(UIImage * _Nullable image, NSData * _
|
|||
/**
|
||||
A `UIImage` instance from `SDWebImageManager` when you specify `SDWebImageRefreshCached` and image cache hit.
|
||||
This can be a hint for image loader to load the image from network and refresh the image from remote location if needed. If the image from remote location does not change, you should call the completion with `SDWebImageErrorCacheNotModified` error. (UIImage)
|
||||
@note If you don't implement `SDWebImageRefreshCached` support, you do not need to care abot this context option.
|
||||
@note If you don't implement `SDWebImageRefreshCached` support, you do not need to care about this context option.
|
||||
*/
|
||||
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextLoaderCachedImage;
|
||||
|
||||
|
@ -53,16 +53,16 @@ FOUNDATION_EXPORT UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NS
|
|||
#pragma mark - SDImageLoader
|
||||
|
||||
/**
|
||||
This is the protocol to specify custom image load process. You can create your own class to conform this protocol and use as a image loader to load image from network or any avaiable remote resources defined by yourself.
|
||||
This is the protocol to specify custom image load process. You can create your own class to conform this protocol and use as a image loader to load image from network or any available remote resources defined by yourself.
|
||||
If you want to implement custom loader for image download from network or local file, you just need to concentrate on image data download only. After the download finish, call `SDImageLoaderDecodeImageData` or `SDImageLoaderDecodeProgressiveImageData` to use the built-in decoding process and produce image (Remember to call in the global queue). And finally callback the completion block.
|
||||
If you directlly get the image instance using some third-party SDKs, such as image directlly from Photos framework. You can process the image data and image instance by yourself without that built-in decoding process. And finally callback the completion block.
|
||||
If you directly get the image instance using some third-party SDKs, such as image directly from Photos framework. You can process the image data and image instance by yourself without that built-in decoding process. And finally callback the completion block.
|
||||
@note It's your responsibility to load the image in the desired global queue(to avoid block main queue). We do not dispatch these method call in a global queue but just from the call queue (For `SDWebImageManager`, it typically call from the main queue).
|
||||
*/
|
||||
@protocol SDImageLoader <NSObject>
|
||||
|
||||
/**
|
||||
Whether current image loader supports to load the provide image URL.
|
||||
This will be checked everytime a new image request come for loader. If this return NO, we will mark this image load as failed. If return YES, we will start to call `requestImageWithURL:options:context:progress:completed:`.
|
||||
This will be checked every time a new image request come for loader. If this return NO, we will mark this image load as failed. If return YES, we will start to call `requestImageWithURL:options:context:progress:completed:`.
|
||||
|
||||
@param url The image URL to be loaded.
|
||||
@return YES to continue download, NO to stop download.
|
||||
|
@ -88,7 +88,7 @@ FOUNDATION_EXPORT UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NS
|
|||
|
||||
|
||||
/**
|
||||
Whether the error from image loader should be marked indded un-recoverable or not.
|
||||
Whether the error from image loader should be marked indeed un-recoverable or not.
|
||||
If this return YES, failed URL which does not using `SDWebImageRetryFailed` will be blocked into black list. Else not.
|
||||
|
||||
@param url The URL represent the image. Note this may not be a HTTP URL
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
- (void)addLoader:(nonnull id<SDImageLoader>)loader;
|
||||
|
||||
/**
|
||||
Remove a image loader in the loaders array.
|
||||
Remove an image loader in the loaders array.
|
||||
|
||||
@param loader loader
|
||||
*/
|
||||
|
|
|
@ -59,7 +59,7 @@ FOUNDATION_EXPORT NSString * _Nullable SDThumbnailedKeyForKey(NSString * _Nullab
|
|||
|
||||
/**
|
||||
Pipeline transformer. Which you can bind multiple transformers together to let the image to be transformed one by one in order and generate the final image.
|
||||
@note Because transformers are lightweight, if you want to append or arrange transfomers, create another pipeline transformer instead. This class is considered as immutable.
|
||||
@note Because transformers are lightweight, if you want to append or arrange transformers, create another pipeline transformer instead. This class is considered as immutable.
|
||||
*/
|
||||
@interface SDImagePipelineTransformer : NSObject <SDImageTransformer>
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ FOUNDATION_EXPORT CGFloat SDImageScaleFactorForKey(NSString * _Nullable key);
|
|||
/**
|
||||
Scale the image with the scale factor for the specify key. If no need to scale, return the original image.
|
||||
This works for `UIImage`(UIKit) or `NSImage`(AppKit). And this function also preserve the associated value in `UIImage+Metadata.h`.
|
||||
@note This is actually a convenience function, which firstlly call `SDImageScaleFactorForKey` and then call `SDScaledImageForScaleFactor`, kept for backward compatibility.
|
||||
@note This is actually a convenience function, which firstly call `SDImageScaleFactorForKey` and then call `SDScaledImageForScaleFactor`, kept for backward compatibility.
|
||||
|
||||
@param key The image cache key
|
||||
@param image The image
|
||||
|
@ -171,7 +171,7 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
|
|||
SDWebImageAvoidDecodeImage = 1 << 18,
|
||||
|
||||
/**
|
||||
* By default, we decode the animated image. This flag can force decode the first frame only and produece the static image.
|
||||
* By default, we decode the animated image. This flag can force decode the first frame only and produce the static image.
|
||||
*/
|
||||
SDWebImageDecodeFirstFrameOnly = 1 << 19,
|
||||
|
||||
|
@ -190,7 +190,7 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
|
|||
|
||||
/**
|
||||
* By default, when we load the image from network, the image will be written to the cache (memory and disk, controlled by your `storeCacheType` context option)
|
||||
* This maybe an asynchronously operation and the final `SDInternalCompletionBlock` callback does not gurantee the disk cache written is finished and may cause logic error. (For example, you modify the disk data just in completion block, however, the disk cache is not ready)
|
||||
* This maybe an asynchronously operation and the final `SDInternalCompletionBlock` callback does not guarantee the disk cache written is finished and may cause logic error. (For example, you modify the disk data just in completion block, however, the disk cache is not ready)
|
||||
* If you need to process with the disk cache in the completion block, you should use this option to ensure the disk cache already been written when callback.
|
||||
* Note if you use this when using the custom cache serializer, or using the transformer, we will also wait until the output image data written is finished.
|
||||
*/
|
||||
|
@ -213,24 +213,24 @@ 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 *)
|
||||
@deprecated Deprecated in the future. 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 in the future. This context options can be replaced by other context option control like `.imageCache`, `.imageLoader`, `.imageTransformer` (See below), which already matches all the properties in SDWebImageManager.
|
||||
*/
|
||||
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCustomManager API_DEPRECATED("Use individual context option like .imageCache, .imageLoader and .imageTransformer instead", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED));
|
||||
|
||||
/**
|
||||
A id<SDImageCache> instance which conforms to `SDImageCache` protocol. It's used to override the image mananger's cache during the image loading pipeline.
|
||||
A id<SDImageCache> instance which conforms to `SDImageCache` protocol. It's used to override the image manager's cache during the image loading pipeline.
|
||||
In other word, if you just want to specify a custom cache during image loading, you don't need to re-create a dummy SDWebImageManager instance with the cache. If not provided, use the image manager's cache (id<SDImageCache>)
|
||||
*/
|
||||
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageCache;
|
||||
|
||||
/**
|
||||
A id<SDImageLoader> instance which conforms to `SDImageLoader` protocol. It's used to override the image mananger's loader during the image loading pipeline.
|
||||
A id<SDImageLoader> instance which conforms to `SDImageLoader` protocol. It's used to override the image manager's loader during the image loading pipeline.
|
||||
In other word, if you just want to specify a custom loader during image loading, you don't need to re-create a dummy SDWebImageManager instance with the loader. If not provided, use the image manager's cache (id<SDImageLoader>)
|
||||
*/
|
||||
FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageLoader;
|
||||
|
||||
/**
|
||||
A id<SDImageCoder> instance which conforms to `SDImageCoder` protocol. It's used to override the default image codre for image decoding(including progressive) and encoding during the image loading process.
|
||||
A id<SDImageCoder> instance which conforms to `SDImageCoder` protocol. It's used to override the default image coder for image decoding(including progressive) and encoding during the image loading process.
|
||||
If you use this context option, we will not always use `SDImageCodersManager.shared` to loop through all registered coders and find the suitable one. Instead, we will arbitrarily use the exact provided coder without extra checking (We may not call `canDecodeFromData:`).
|
||||
@note This is only useful for cases which you can ensure the loading url matches your coder, or you find it's too hard to write a common coder which can used for generic usage. This will bind the loading url with the coder logic, which is not always a good design, but possible. (id<SDImageCache>)
|
||||
*/
|
||||
|
|
|
@ -78,7 +78,7 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
|
|||
SDWebImageDownloaderAvoidDecodeImage = 1 << 9,
|
||||
|
||||
/**
|
||||
* By default, we decode the animated image. This flag can force decode the first frame only and produece the static image.
|
||||
* By default, we decode the animated image. This flag can force decode the first frame only and produce the static image.
|
||||
*/
|
||||
SDWebImageDownloaderDecodeFirstFrameOnly = 1 << 10,
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {
|
|||
|
||||
/**
|
||||
* Set password using for HTTP Basic authentication.
|
||||
* Defautls to nil.
|
||||
* Defaults to nil.
|
||||
*/
|
||||
@property (nonatomic, copy, nullable) NSString *password;
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ We can use a block to specify the downloader decryptor. But Using protocol can m
|
|||
*/
|
||||
@protocol SDWebImageDownloaderDecryptor <NSObject>
|
||||
|
||||
/// Decrypt the original download data and return a new data. You can use this to decrypt the data using your perfereed algorithm.
|
||||
/// Decrypt the original download data and return a new data. You can use this to decrypt the data using your preferred algorithm.
|
||||
/// @param data The original download data
|
||||
/// @param response The URL response for data. If you modifiy the original URL response via response modifier, the modified version will be here. This arg is nullable.
|
||||
/// @param response The URL response for data. If you modify the original URL response via response modifier, the modified version will be here. This arg is nullable.
|
||||
/// @note If nil is returned, the image download will be marked as failed with error `SDWebImageErrorBadImageData`
|
||||
- (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
/**
|
||||
* The collected metrics from `-URLSession:task:didFinishCollectingMetrics:`.
|
||||
* This can be used to collect the network metrics like download duration, DNS lookup duration, SSL handshake dureation, etc. See Apple's documentation: https://developer.apple.com/documentation/foundation/urlsessiontaskmetrics
|
||||
* This can be used to collect the network metrics like download duration, DNS lookup duration, SSL handshake duration, etc. See Apple's documentation: https://developer.apple.com/documentation/foundation/urlsessiontaskmetrics
|
||||
*/
|
||||
@property (strong, nonatomic, readonly, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0));
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
|
|||
@property (strong, nonatomic, nullable) NSError *responseError;
|
||||
@property (assign, nonatomic) double previousProgress; // previous progress percent
|
||||
|
||||
@property (strong, nonatomic, nullable) id<SDWebImageDownloaderResponseModifier> responseModifier; // modifiy original URLResponse
|
||||
@property (strong, nonatomic, nullable) id<SDWebImageDownloaderResponseModifier> responseModifier; // modify original URLResponse
|
||||
@property (strong, nonatomic, nullable) id<SDWebImageDownloaderDecryptor> decryptor; // decrypt image data
|
||||
|
||||
// This is weak because it is injected by whoever manages this session. If this gets nil-ed out, we won't be able to run
|
||||
|
|
|
@ -50,7 +50,7 @@ A convenient request modifier to provide the HTTP request including HTTP Method,
|
|||
- (nonnull instancetype)initWithMethod:(nullable NSString *)method;
|
||||
|
||||
/// Create the request modifier with HTTP Headers.
|
||||
/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will overide the same fileds from original request.
|
||||
/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request.
|
||||
/// @note This is for convenience, if you need code to control the logic, use block API instead.
|
||||
- (nonnull instancetype)initWithHeaders:(nullable NSDictionary<NSString *, NSString *> *)headers;
|
||||
|
||||
|
@ -61,7 +61,7 @@ A convenient request modifier to provide the HTTP request including HTTP Method,
|
|||
|
||||
/// Create the request modifier with HTTP Method, Headers and Body.
|
||||
/// @param method HTTP Method, nil means to GET.
|
||||
/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will overide the same fileds from original request.
|
||||
/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request.
|
||||
/// @param body HTTP Body.
|
||||
/// @note This is for convenience, if you need code to control the logic, use block API instead.
|
||||
- (nonnull instancetype)initWithMethod:(nullable NSString *)method headers:(nullable NSDictionary<NSString *, NSString *> *)headers body:(nullable NSData *)body;
|
||||
|
|
|
@ -55,14 +55,14 @@ A convenient response modifier to provide the HTTP response including HTTP Statu
|
|||
- (nonnull instancetype)initWithVersion:(nullable NSString *)version;
|
||||
|
||||
/// Create the response modifier with HTTP Headers. Status code defaults to 200.
|
||||
/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will overide the same fileds from original response.
|
||||
/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response.
|
||||
/// @note This is for convenience, if you need code to control the logic, use block API instead.
|
||||
- (nonnull instancetype)initWithHeaders:(nullable NSDictionary<NSString *, NSString *> *)headers;
|
||||
|
||||
/// Create the response modifier with HTTP Status Code, Version and Headers.
|
||||
/// @param statusCode HTTP Status Code.
|
||||
/// @param version HTTP Version, nil means "HTTP/1.1".
|
||||
/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will overide the same fileds from original response.
|
||||
/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response.
|
||||
/// @note This is for convenience, if you need code to control the logic, use block API instead.
|
||||
- (nonnull instancetype)initWithStatusCode:(NSInteger)statusCode version:(nullable NSString *)version headers:(nullable NSDictionary<NSString *, NSString *> *)headers;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) {
|
|||
SDWebImageErrorInvalidURL = 1000, // The URL is invalid, such as nil URL or corrupted URL
|
||||
SDWebImageErrorBadImageData = 1001, // The image data can not be decoded to image, or the image data is empty
|
||||
SDWebImageErrorCacheNotModified = 1002, // The remote location specify that the cached image is not modified, such as the HTTP response 304 code. It's useful for `SDWebImageRefreshCached`
|
||||
SDWebImageErrorBlackListed = 1003, // The URL is blacklisted because of unrecoverable failsure marked by downloader (such as 404), you can use `.retryFailed` option to avoid this
|
||||
SDWebImageErrorBlackListed = 1003, // The URL is blacklisted because of unrecoverable failure marked by downloader (such as 404), you can use `.retryFailed` option to avoid this
|
||||
SDWebImageErrorInvalidDownloadOperation = 2000, // The image download operation is invalid, such as nil operation or unexpected error occur when operation initialized
|
||||
SDWebImageErrorInvalidDownloadStatusCode = 2001, // The image download response a invalid status code. You can check the status code in error's userInfo under `SDWebImageErrorDownloadStatusCodeKey`
|
||||
SDWebImageErrorCancelled = 2002, // The image loading operation is cancelled before finished, during either async disk cache query, or waiting before actual network request. For actual network request error, check `NSURLErrorDomain` error domain and code.
|
||||
|
|
|
@ -98,7 +98,7 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
@interface SDWebImageManager : NSObject
|
||||
|
||||
/**
|
||||
* The delegate for manager. Defatuls to nil.
|
||||
* The delegate for manager. Defaults to nil.
|
||||
*/
|
||||
@property (weak, nonatomic, nullable) id <SDWebImageManagerDelegate> delegate;
|
||||
|
||||
|
@ -136,8 +136,8 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
|
||||
/**
|
||||
* The cache serializer is used to convert the decoded image, the source downloaded data, to the actual data used for storing to the disk cache. If you return nil, means to generate the data from the image instance, see `SDImageCache`.
|
||||
* For example, if you are using WebP images and facing the slow decoding time issue when later retriving from disk cache again. You can try to encode the decoded image to JPEG/PNG format to disk cache instead of source downloaded data.
|
||||
* @note The `image` arg is nonnull, but when you also provide a image transformer and the image is transformed, the `data` arg may be nil, take attention to this case.
|
||||
* For example, if you are using WebP images and facing the slow decoding time issue when later retrieving from disk cache again. You can try to encode the decoded image to JPEG/PNG format to disk cache instead of source downloaded data.
|
||||
* @note The `image` arg is nonnull, but when you also provide an image transformer and the image is transformed, the `data` arg may be nil, take attention to this case.
|
||||
* @note This method is called from a global queue in order to not to block the main thread.
|
||||
* @code
|
||||
SDWebImageManager.sharedManager.cacheSerializer = [SDWebImageCacheSerializer cacheSerializerWithBlock:^NSData * _Nullable(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL) {
|
||||
|
@ -225,7 +225,7 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
|||
* The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache
|
||||
* or from the memory cache or from the network.
|
||||
*
|
||||
* The fith parameter is set to NO when the SDWebImageProgressiveLoad option is used and the image is
|
||||
* The fifth parameter is set to NO when the SDWebImageProgressiveLoad option is used and the image is
|
||||
* downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded, the
|
||||
* block is called a last time with the full image and the last parameter set to YES.
|
||||
*
|
||||
|
|
|
@ -279,7 +279,7 @@ static id<SDImageLoader> _defaultImageLoader;
|
|||
[self safelyRemoveOperationFromRunning:operation];
|
||||
return;
|
||||
} else if (context[SDWebImageContextImageTransformer] && !cachedImage) {
|
||||
// Have a chance to quary original cache instead of downloading
|
||||
// Have a chance to query original cache instead of downloading
|
||||
[self callOriginalCacheProcessForOperation:operation url:url options:options context:context progress:progressBlock completed:completedBlock];
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls,
|
|||
@property (strong, nonatomic, nonnull) dispatch_queue_t delegateQueue;
|
||||
|
||||
/**
|
||||
* The delegate for the prefetcher. Defatuls to nil.
|
||||
* The delegate for the prefetcher. Defaults to nil.
|
||||
*/
|
||||
@property (weak, nonatomic, nullable) id <SDWebImagePrefetcherDelegate> delegate;
|
||||
|
||||
|
@ -108,7 +108,7 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls,
|
|||
|
||||
/**
|
||||
* Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching. It based on the image manager so the image may from the cache and network according to the `options` property.
|
||||
* Prefetching is seperate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls.
|
||||
* Prefetching is separate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls.
|
||||
* Attention that call this will not cancel previous fetched urls. You should keep the token return by this to cancel or cancel all the prefetch.
|
||||
*
|
||||
* @param urls list of URLs to prefetch
|
||||
|
@ -118,7 +118,7 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls,
|
|||
|
||||
/**
|
||||
* Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching. It based on the image manager so the image may from the cache and network according to the `options` property.
|
||||
* Prefetching is seperate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls.
|
||||
* Prefetching is separate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls.
|
||||
* Attention that call this will not cancel previous fetched urls. You should keep the token return by this to cancel or cancel all the prefetch.
|
||||
*
|
||||
* @param urls list of URLs to prefetch
|
||||
|
|
|
@ -46,7 +46,7 @@ typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished);
|
|||
@interface SDWebImageTransition : NSObject
|
||||
|
||||
/**
|
||||
By default, we set the image to the view at the beginning of the animtions. You can disable this and provide custom set image process
|
||||
By default, we set the image to the view at the beginning of the animations. You can disable this and provide custom set image process
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL avoidAutoSetImage;
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#import "SDWebImageCompat.h"
|
||||
|
||||
/**
|
||||
This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directlly use `SDImageCoder`.
|
||||
This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directly use `SDImageCoder`.
|
||||
*/
|
||||
@interface UIImage (GIF)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
The memory cache cost for specify image used by image cache. The cost function is the bytes size held in memory.
|
||||
If you set some associated object to `UIImage`, you can set the custom value to indicate the memory cost.
|
||||
|
||||
For `UIImage`, this method return the single frame bytes size when `image.images` is nil for static image. Retuen full frame bytes size when `image.images` is not nil for animated image.
|
||||
For `UIImage`, this method return the single frame bytes size when `image.images` is nil for static image. Return full frame bytes size when `image.images` is not nil for animated image.
|
||||
For `NSImage`, this method return the single frame bytes size because `NSImage` does not store all frames in memory.
|
||||
@note Note that because of the limitations of category this property can get out of sync if you create another instance with CGImage or other methods.
|
||||
@note For custom animated class conforms to `SDAnimatedImage`, you can override this getter method in your subclass to return a more proper value instead, which representing the current frame's total bytes.
|
||||
|
|
|
@ -27,7 +27,7 @@ typedef NS_OPTIONS(NSUInteger, SDRectCorner) {
|
|||
#endif
|
||||
|
||||
/**
|
||||
Provide some commen method for `UIImage`.
|
||||
Provide some common method for `UIImage`.
|
||||
Image process is based on Core Graphics and vImage.
|
||||
*/
|
||||
@interface UIImage (Transform)
|
||||
|
|
|
@ -34,15 +34,15 @@ typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable ima
|
|||
/**
|
||||
* Get the current image operation key. Operation key is used to identify the different queries for one view instance (like UIButton).
|
||||
* See more about this in `SDWebImageContextSetImageOperationKey`.
|
||||
* @note You can use method `UIView+WebCacheOperation` to invesigate different queries' operation.
|
||||
* @note You can use method `UIView+WebCacheOperation` to investigate different queries' operation.
|
||||
*/
|
||||
@property (nonatomic, strong, readonly, nullable) NSString *sd_latestOperationKey;
|
||||
|
||||
/**
|
||||
* The current image loading progress associated to the view. The unit count is the received size and excepted size of download.
|
||||
* The `totalUnitCount` and `completedUnitCount` will be reset to 0 after a new image loading start (change from current queue). And they will be set to `SDWebImageProgressUnitCountUnknown` if the progressBlock not been called but the image loading success to mark the progress finished (change from main queue).
|
||||
* @note You can use Key-Value Observing on the progress, but you should take care that the change to progress is from a background queue during download(the same as progressBlock). If you want to using KVO and update the UI, make sure to dispatch on the main queue. And it's recommand to use some KVO libs like KVOController because it's more safe and easy to use.
|
||||
* @note The getter will create a progress instance if the value is nil. But by default, we don't create one. If you need to use Key-Value Observing, you must trigger the getter or set a custom progresss instance before the loading start. The default value is nil.
|
||||
* @note You can use Key-Value Observing on the progress, but you should take care that the change to progress is from a background queue during download(the same as progressBlock). If you want to using KVO and update the UI, make sure to dispatch on the main queue. And it's recommend to use some KVO libs like KVOController because it's more safe and easy to use.
|
||||
* @note The getter will create a progress instance if the value is nil. But by default, we don't create one. If you need to use Key-Value Observing, you must trigger the getter or set a custom progress instance before the loading start. The default value is nil.
|
||||
* @note Note that because of the limitations of categories this property can get out of sync if you update the progress directly.
|
||||
*/
|
||||
@property (nonatomic, strong, null_resettable) NSProgress *sd_imageProgress;
|
||||
|
@ -66,7 +66,7 @@ typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable ima
|
|||
* The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache
|
||||
* or from the memory cache or from the network.
|
||||
*
|
||||
* The fith parameter normally is always YES. However, if you provide SDWebImageAvoidAutoSetImage with SDWebImageProgressiveLoad options to enable progressive downloading and set the image yourself. This block is thus called repeatedly with a partial image. When image is fully downloaded, the
|
||||
* The fifth parameter normally is always YES. However, if you provide SDWebImageAvoidAutoSetImage with SDWebImageProgressiveLoad options to enable progressive downloading and set the image yourself. This block is thus called repeatedly with a partial image. When image is fully downloaded, the
|
||||
* block is called a last time with the full image and the last parameter set to YES.
|
||||
*
|
||||
* The last parameter is the original image URL
|
||||
|
@ -90,7 +90,7 @@ typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable ima
|
|||
|
||||
/**
|
||||
The image transition when image load finished. See `SDWebImageTransition`.
|
||||
If you specify nil, do not do transition. Defautls to nil.
|
||||
If you specify nil, do not do transition. Defaults to nil.
|
||||
*/
|
||||
@property (nonatomic, strong, nullable) SDWebImageTransition *sd_imageTransition;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
/**
|
||||
These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external.
|
||||
All the stored operations are weak, so it will be dalloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them.
|
||||
All the stored operations are weak, so it will be dealloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them.
|
||||
*/
|
||||
@interface UIView (WebCacheOperation)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
static char loadOperationKey;
|
||||
|
||||
// key is strong, value is weak because operation instance is retained by SDWebImageManager's runningOperations property
|
||||
// we should use lock to keep thread-safe because these method may not be acessed from main queue
|
||||
// we should use lock to keep thread-safe because these method may not be accessed from main queue
|
||||
typedef NSMapTable<NSString *, id<SDWebImageOperation>> SDOperationsDictionary;
|
||||
|
||||
@implementation UIView (WebCacheOperation)
|
||||
|
|
Loading…
Reference in New Issue