Remove SDWebImageProgressIndicator protocol. Add this as an optional method in SDWebImageIndicator
This commit is contained in:
parent
d28870cd52
commit
89babbbfbe
|
@ -30,16 +30,10 @@
|
|||
*/
|
||||
- (void)stopAnimatingIndicator;
|
||||
|
||||
@end
|
||||
|
||||
// A protocol to custom the indicator which need update when loading progress changed
|
||||
// All of these methods are called from main queue
|
||||
@protocol SDWebImageProgressIndicator <SDWebImageIndicator>
|
||||
|
||||
@required
|
||||
@optional
|
||||
/**
|
||||
Update the progress (0-1.0) for progress indicator.
|
||||
|
||||
Update the loading progress (0-1.0) for indicator. Optional
|
||||
|
||||
@param progress The progress, value between 0 and 1.0
|
||||
*/
|
||||
- (void)updateIndicatorProgress:(double)progress;
|
||||
|
@ -80,7 +74,7 @@
|
|||
// Progress indicator class
|
||||
// for UIKit(macOS), it use a `UIProgressView`
|
||||
// for AppKit(macOS), it use a `NSProgressIndicator` with the bar style
|
||||
@interface SDWebImageProgressIndicator : NSObject <SDWebImageProgressIndicator>
|
||||
@interface SDWebImageProgressIndicator : NSObject <SDWebImageIndicator>
|
||||
|
||||
#if SD_UIKIT
|
||||
@property (nonatomic, strong, readonly, nonnull) UIProgressView *indicatorView;
|
||||
|
|
|
@ -96,10 +96,10 @@ static char imageURLKey;
|
|||
if (progressBlock) {
|
||||
progressBlock(receivedSize, expectedSize, targetURL);
|
||||
}
|
||||
if ([imageIndicator conformsToProtocol:@protocol(SDWebImageProgressIndicator)]) {
|
||||
if ([imageIndicator respondsToSelector:@selector(updateIndicatorProgress:)]) {
|
||||
double progress = wself.sd_imageProgress.fractionCompleted;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[((id<SDWebImageProgressIndicator>)imageIndicator) updateIndicatorProgress:progress];
|
||||
[imageIndicator updateIndicatorProgress:progress];
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue