Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Typos throughout project #3026

Merged
merged 2 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Docs/SDWebImage-5.0-Migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion SDWebImage/Core/NSData+ImageContentType.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions SDWebImage/Core/SDAnimatedImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions SDWebImage/Core/SDAnimatedImagePlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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.
Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions SDWebImage/Core/SDAnimatedImagePlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ - (void)displayDidRefresh:(SDDisplayLink *)displayLink {
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;
Expand All @@ -299,7 +299,7 @@ - (void)displayDidRefresh:(SDDisplayLink *)displayLink {
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;
Expand Down Expand Up @@ -352,7 +352,7 @@ - (void)handleFrameChange {
}
}

- (void)handleLoopChnage {
- (void)handleLoopChange {
if (self.animationLoopHandler) {
self.animationLoopHandler(self.currentLoopCount);
}
Expand Down
8 changes: 4 additions & 4 deletions SDWebImage/Core/SDAnimatedImageRep.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ - (void)dealloc {
}
}

// `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) {
Expand All @@ -58,14 +58,14 @@ - (instancetype)initWithData:(NSData *)data {
[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];
Expand Down
2 changes: 1 addition & 1 deletion SDWebImage/Core/SDAnimatedImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ - (void)setImage:(UIImage *)image
} else {
provider = (id<SDAnimatedImage>)image;
}
// Create animted player
// Create animated player
self.player = [SDAnimatedImagePlayer playerWithProvider:provider];
} else {
// Update Frame Count
Expand Down
2 changes: 1 addition & 1 deletion SDWebImage/Core/SDDiskCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ - (void)setData:(NSData *)data forKey:(NSString *)key {

// 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];
Expand Down
2 changes: 1 addition & 1 deletion SDWebImage/Core/SDImageAPNGCoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions SDWebImage/Core/SDImageCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
/**
Expand All @@ -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,
Expand All @@ -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;

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion SDWebImage/Core/SDImageCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ - (void)removeImageFromDiskForKey:(NSString *)key {
});
}

// 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;
Expand Down
8 changes: 4 additions & 4 deletions SDWebImage/Core/SDImageCacheConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -115,22 +115,22 @@ 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;

/**
* 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;

Expand Down
14 changes: 7 additions & 7 deletions SDWebImage/Core/SDImageCacheDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
*/
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down