Fix the watchOS compile issue, put the associated object and web cache category into a standalone file
This commit is contained in:
parent
956be3619f
commit
4b2c5042fa
|
@ -15,6 +15,14 @@
|
||||||
324F61CC235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */; };
|
324F61CC235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */; };
|
||||||
324F61CD235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */; };
|
324F61CD235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */; };
|
||||||
324F61CE235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */; };
|
324F61CE235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */; };
|
||||||
|
3253E05823879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3253E05623879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
3253E05923879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3253E05623879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
3253E05A23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3253E05623879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
3253E05B23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3253E05623879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
3253E05C23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 3253E05723879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m */; };
|
||||||
|
3253E05D23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 3253E05723879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m */; };
|
||||||
|
3253E05E23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 3253E05723879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m */; };
|
||||||
|
3253E05F23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 3253E05723879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m */; };
|
||||||
326B84822363350C0011BDFB /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 326B84812363350C0011BDFB /* Indicator.swift */; };
|
326B84822363350C0011BDFB /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 326B84812363350C0011BDFB /* Indicator.swift */; };
|
||||||
326B84832363350C0011BDFB /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 326B84812363350C0011BDFB /* Indicator.swift */; };
|
326B84832363350C0011BDFB /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 326B84812363350C0011BDFB /* Indicator.swift */; };
|
||||||
326B84842363350C0011BDFB /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 326B84812363350C0011BDFB /* Indicator.swift */; };
|
326B84842363350C0011BDFB /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 326B84812363350C0011BDFB /* Indicator.swift */; };
|
||||||
|
@ -123,6 +131,8 @@
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
324F61C5235E07EC003973B8 /* SDAnimatedImageInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDAnimatedImageInterface.h; sourceTree = "<group>"; };
|
324F61C5235E07EC003973B8 /* SDAnimatedImageInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDAnimatedImageInterface.h; sourceTree = "<group>"; };
|
||||||
324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDAnimatedImageInterface.m; sourceTree = "<group>"; };
|
324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDAnimatedImageInterface.m; sourceTree = "<group>"; };
|
||||||
|
3253E05623879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SDAnimatedImageInterface+WebCache.h"; sourceTree = "<group>"; };
|
||||||
|
3253E05723879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SDAnimatedImageInterface+WebCache.m"; sourceTree = "<group>"; };
|
||||||
326B84812363350C0011BDFB /* Indicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Indicator.swift; sourceTree = "<group>"; };
|
326B84812363350C0011BDFB /* Indicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Indicator.swift; sourceTree = "<group>"; };
|
||||||
326B8486236335110011BDFB /* ActivityIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivityIndicator.swift; sourceTree = "<group>"; };
|
326B8486236335110011BDFB /* ActivityIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivityIndicator.swift; sourceTree = "<group>"; };
|
||||||
326B848B236335400011BDFB /* ProgressIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressIndicator.swift; sourceTree = "<group>"; };
|
326B848B236335400011BDFB /* ProgressIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressIndicator.swift; sourceTree = "<group>"; };
|
||||||
|
@ -187,6 +197,8 @@
|
||||||
children = (
|
children = (
|
||||||
324F61C5235E07EC003973B8 /* SDAnimatedImageInterface.h */,
|
324F61C5235E07EC003973B8 /* SDAnimatedImageInterface.h */,
|
||||||
324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */,
|
324F61C6235E07EC003973B8 /* SDAnimatedImageInterface.m */,
|
||||||
|
3253E05623879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h */,
|
||||||
|
3253E05723879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m */,
|
||||||
3276EAFE237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h */,
|
3276EAFE237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h */,
|
||||||
3276EAFF237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.m */,
|
3276EAFF237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.m */,
|
||||||
);
|
);
|
||||||
|
@ -274,6 +286,7 @@
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
3253E05823879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h in Headers */,
|
||||||
3276EB00237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h in Headers */,
|
3276EB00237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h in Headers */,
|
||||||
324F61C7235E07EC003973B8 /* SDAnimatedImageInterface.h in Headers */,
|
324F61C7235E07EC003973B8 /* SDAnimatedImageInterface.h in Headers */,
|
||||||
32C43DE622FD54CD00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
|
32C43DE622FD54CD00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
|
||||||
|
@ -284,6 +297,7 @@
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
3253E05923879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h in Headers */,
|
||||||
3276EB01237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h in Headers */,
|
3276EB01237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h in Headers */,
|
||||||
324F61C8235E07EC003973B8 /* SDAnimatedImageInterface.h in Headers */,
|
324F61C8235E07EC003973B8 /* SDAnimatedImageInterface.h in Headers */,
|
||||||
32C43E2222FD583A00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
|
32C43E2222FD583A00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
|
||||||
|
@ -294,6 +308,7 @@
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
3253E05A23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h in Headers */,
|
||||||
3276EB02237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h in Headers */,
|
3276EB02237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h in Headers */,
|
||||||
324F61C9235E07EC003973B8 /* SDAnimatedImageInterface.h in Headers */,
|
324F61C9235E07EC003973B8 /* SDAnimatedImageInterface.h in Headers */,
|
||||||
32C43E2322FD583B00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
|
32C43E2322FD583B00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
|
||||||
|
@ -304,6 +319,7 @@
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
3253E05B23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.h in Headers */,
|
||||||
3276EB03237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h in Headers */,
|
3276EB03237760D800B385D4 /* SDAnimatedImageInterfaceWrapper.h in Headers */,
|
||||||
324F61CA235E07EC003973B8 /* SDAnimatedImageInterface.h in Headers */,
|
324F61CA235E07EC003973B8 /* SDAnimatedImageInterface.h in Headers */,
|
||||||
32C43E2422FD583C00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
|
32C43E2422FD583C00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
|
||||||
|
@ -482,6 +498,7 @@
|
||||||
326E480A23431C0F00C633E9 /* ImageViewWrapper.swift in Sources */,
|
326E480A23431C0F00C633E9 /* ImageViewWrapper.swift in Sources */,
|
||||||
326B8487236335110011BDFB /* ActivityIndicator.swift in Sources */,
|
326B8487236335110011BDFB /* ActivityIndicator.swift in Sources */,
|
||||||
32C43E1622FD583700BE87F5 /* ImageManager.swift in Sources */,
|
32C43E1622FD583700BE87F5 /* ImageManager.swift in Sources */,
|
||||||
|
3253E05C23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m in Sources */,
|
||||||
32C43E1822FD583700BE87F5 /* AnimatedImage.swift in Sources */,
|
32C43E1822FD583700BE87F5 /* AnimatedImage.swift in Sources */,
|
||||||
324F61CB235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */,
|
324F61CB235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */,
|
||||||
);
|
);
|
||||||
|
@ -500,6 +517,7 @@
|
||||||
326E480B23431C0F00C633E9 /* ImageViewWrapper.swift in Sources */,
|
326E480B23431C0F00C633E9 /* ImageViewWrapper.swift in Sources */,
|
||||||
326B8488236335110011BDFB /* ActivityIndicator.swift in Sources */,
|
326B8488236335110011BDFB /* ActivityIndicator.swift in Sources */,
|
||||||
32C43E1922FD583700BE87F5 /* ImageManager.swift in Sources */,
|
32C43E1922FD583700BE87F5 /* ImageManager.swift in Sources */,
|
||||||
|
3253E05D23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m in Sources */,
|
||||||
32C43E1B22FD583700BE87F5 /* AnimatedImage.swift in Sources */,
|
32C43E1B22FD583700BE87F5 /* AnimatedImage.swift in Sources */,
|
||||||
324F61CC235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */,
|
324F61CC235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */,
|
||||||
);
|
);
|
||||||
|
@ -518,6 +536,7 @@
|
||||||
326E480C23431C0F00C633E9 /* ImageViewWrapper.swift in Sources */,
|
326E480C23431C0F00C633E9 /* ImageViewWrapper.swift in Sources */,
|
||||||
326B8489236335110011BDFB /* ActivityIndicator.swift in Sources */,
|
326B8489236335110011BDFB /* ActivityIndicator.swift in Sources */,
|
||||||
32C43E1C22FD583800BE87F5 /* ImageManager.swift in Sources */,
|
32C43E1C22FD583800BE87F5 /* ImageManager.swift in Sources */,
|
||||||
|
3253E05E23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m in Sources */,
|
||||||
32C43E1E22FD583800BE87F5 /* AnimatedImage.swift in Sources */,
|
32C43E1E22FD583800BE87F5 /* AnimatedImage.swift in Sources */,
|
||||||
324F61CD235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */,
|
324F61CD235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */,
|
||||||
);
|
);
|
||||||
|
@ -536,6 +555,7 @@
|
||||||
326E480D23431C0F00C633E9 /* ImageViewWrapper.swift in Sources */,
|
326E480D23431C0F00C633E9 /* ImageViewWrapper.swift in Sources */,
|
||||||
326B848A236335110011BDFB /* ActivityIndicator.swift in Sources */,
|
326B848A236335110011BDFB /* ActivityIndicator.swift in Sources */,
|
||||||
32C43E1F22FD583800BE87F5 /* ImageManager.swift in Sources */,
|
32C43E1F22FD583800BE87F5 /* ImageManager.swift in Sources */,
|
||||||
|
3253E05F23879A6F007ACAD8 /* SDAnimatedImageInterface+WebCache.m in Sources */,
|
||||||
32C43E2122FD583800BE87F5 /* AnimatedImage.swift in Sources */,
|
32C43E2122FD583800BE87F5 /* AnimatedImage.swift in Sources */,
|
||||||
324F61CE235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */,
|
324F61CE235E07EC003973B8 /* SDAnimatedImageInterface.m in Sources */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -231,11 +231,19 @@ public struct AnimatedImage : PlatformViewRepresentable {
|
||||||
let image = SDAnimatedImage(named: name, in: imageModel.bundle, compatibleWith: nil)
|
let image = SDAnimatedImage(named: name, in: imageModel.bundle, compatibleWith: nil)
|
||||||
#endif
|
#endif
|
||||||
view.wrapped.sd_imageName = name
|
view.wrapped.sd_imageName = name
|
||||||
|
#if os(iOS) || os(tvOS) || os(macOS)
|
||||||
view.wrapped.image = image
|
view.wrapped.image = image
|
||||||
|
#else
|
||||||
|
view.wrapped.setImage(image)
|
||||||
|
#endif
|
||||||
} else if let data = imageModel.data, data != view.wrapped.sd_imageData {
|
} else if let data = imageModel.data, data != view.wrapped.sd_imageData {
|
||||||
let image = SDAnimatedImage(data: data, scale: imageModel.scale)
|
let image = SDAnimatedImage(data: data, scale: imageModel.scale)
|
||||||
view.wrapped.sd_imageData = data
|
view.wrapped.sd_imageData = data
|
||||||
|
#if os(iOS) || os(tvOS) || os(macOS)
|
||||||
view.wrapped.image = image
|
view.wrapped.image = image
|
||||||
|
#else
|
||||||
|
view.wrapped.setImage(image)
|
||||||
|
#endif
|
||||||
} else if let url = imageModel.url, url != view.wrapped.sd_imageURL {
|
} else if let url = imageModel.url, url != view.wrapped.sd_imageURL {
|
||||||
#if os(macOS) || os(iOS) || os(tvOS)
|
#if os(macOS) || os(iOS) || os(tvOS)
|
||||||
view.wrapped.sd_imageIndicator = imageConfiguration.indicator
|
view.wrapped.sd_imageIndicator = imageConfiguration.indicator
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the SDWebImage package.
|
||||||
|
* (c) DreamPiggy <lizhuoli1126@126.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "SDAnimatedImageInterface.h"
|
||||||
|
|
||||||
|
#if SD_WATCH
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
/// Do not use this class directly in WatchKit or Storyboard. This class is implementation detail and will be removed in the future.
|
||||||
|
/// This is not public API at all.
|
||||||
|
@interface SDAnimatedImageInterface (WebCache)
|
||||||
|
|
||||||
|
@property (nonatomic, strong, nullable) NSString *sd_imageName;
|
||||||
|
@property (nonatomic, strong, nullable) NSData *sd_imageData;
|
||||||
|
|
||||||
|
- (void)sd_setImageWithURL:(nullable NSURL *)url
|
||||||
|
placeholderImage:(nullable UIImage *)placeholder
|
||||||
|
options:(SDWebImageOptions)options
|
||||||
|
context:(nullable SDWebImageContext *)context
|
||||||
|
progress:(nullable SDImageLoaderProgressBlock)progressBlock
|
||||||
|
completed:(nullable SDExternalCompletionBlock)completedBlock;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
#endif
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the SDWebImage package.
|
||||||
|
* (c) DreamPiggy <lizhuoli1126@126.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "SDAnimatedImageInterface+WebCache.h"
|
||||||
|
#import <objc/runtime.h>
|
||||||
|
|
||||||
|
@implementation SDAnimatedImageInterface (WebCache)
|
||||||
|
|
||||||
|
- (NSString *)sd_imageName {
|
||||||
|
return objc_getAssociatedObject(self, @selector(sd_imageName));
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setSd_imageName:(NSString *)sd_imageName {
|
||||||
|
objc_setAssociatedObject(self, @selector(sd_imageName), sd_imageName, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSData *)sd_imageData {
|
||||||
|
return objc_getAssociatedObject(self, @selector(sd_imageData));
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setSd_imageData:(NSData *)sd_imageData {
|
||||||
|
objc_setAssociatedObject(self, @selector(sd_imageData), sd_imageData, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)sd_setImageWithURL:(nullable NSURL *)url
|
||||||
|
placeholderImage:(nullable UIImage *)placeholder
|
||||||
|
options:(SDWebImageOptions)options
|
||||||
|
context:(nullable SDWebImageContext *)context
|
||||||
|
progress:(nullable SDImageLoaderProgressBlock)progressBlock
|
||||||
|
completed:(nullable SDExternalCompletionBlock)completedBlock {
|
||||||
|
Class animatedImageClass = [SDAnimatedImage class];
|
||||||
|
SDWebImageMutableContext *mutableContext;
|
||||||
|
if (context) {
|
||||||
|
mutableContext = [context mutableCopy];
|
||||||
|
} else {
|
||||||
|
mutableContext = [NSMutableDictionary dictionary];
|
||||||
|
}
|
||||||
|
mutableContext[SDWebImageContextAnimatedImageClass] = animatedImageClass;
|
||||||
|
[self sd_internalSetImageWithURL:url
|
||||||
|
placeholderImage:placeholder
|
||||||
|
options:options
|
||||||
|
context:mutableContext
|
||||||
|
setImageBlock:nil
|
||||||
|
progress:progressBlock
|
||||||
|
completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
|
||||||
|
if (completedBlock) {
|
||||||
|
completedBlock(image, error, cacheType, imageURL);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
|
@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
/// This is not public API at all.
|
/// This is not public API at all.
|
||||||
@interface SDAnimatedImageInterface : WKInterfaceImage
|
@interface SDAnimatedImageInterface : WKInterfaceImage
|
||||||
|
|
||||||
|
@property (nonatomic, strong, readonly, nullable) UIImage *image;
|
||||||
@property (nonatomic, assign, getter=isAnimating, readonly) BOOL animating;
|
@property (nonatomic, assign, getter=isAnimating, readonly) BOOL animating;
|
||||||
@property (nonatomic, assign) SDImageScaleMode contentMode;
|
@property (nonatomic, assign) SDImageScaleMode contentMode;
|
||||||
@property (nonatomic, strong, nullable) NSNumber *animationRepeatCount;
|
@property (nonatomic, strong, nullable) NSNumber *animationRepeatCount;
|
||||||
|
|
|
@ -57,9 +57,7 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SDAnimatedImageInterface () {
|
@interface SDAnimatedImageInterface ()
|
||||||
UIImage *_image;
|
|
||||||
}
|
|
||||||
|
|
||||||
@property (nonatomic, strong, readwrite) UIImage *currentFrame;
|
@property (nonatomic, strong, readwrite) UIImage *currentFrame;
|
||||||
@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex;
|
@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex;
|
||||||
|
@ -213,41 +211,4 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#pragma mark - Web Cache
|
|
||||||
|
|
||||||
@interface SDAnimatedImageInterface (WebCache)
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation SDAnimatedImageInterface (WebCache)
|
|
||||||
|
|
||||||
- (void)sd_setImageWithURL:(nullable NSURL *)url
|
|
||||||
placeholderImage:(nullable UIImage *)placeholder
|
|
||||||
options:(SDWebImageOptions)options
|
|
||||||
context:(nullable SDWebImageContext *)context
|
|
||||||
progress:(nullable SDImageLoaderProgressBlock)progressBlock
|
|
||||||
completed:(nullable SDExternalCompletionBlock)completedBlock {
|
|
||||||
Class animatedImageClass = [SDAnimatedImage class];
|
|
||||||
SDWebImageMutableContext *mutableContext;
|
|
||||||
if (context) {
|
|
||||||
mutableContext = [context mutableCopy];
|
|
||||||
} else {
|
|
||||||
mutableContext = [NSMutableDictionary dictionary];
|
|
||||||
}
|
|
||||||
mutableContext[SDWebImageContextAnimatedImageClass] = animatedImageClass;
|
|
||||||
[self sd_internalSetImageWithURL:url
|
|
||||||
placeholderImage:placeholder
|
|
||||||
options:options
|
|
||||||
context:mutableContext
|
|
||||||
setImageBlock:nil
|
|
||||||
progress:progressBlock
|
|
||||||
completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
|
|
||||||
if (completedBlock) {
|
|
||||||
completedBlock(image, error, cacheType, imageURL);
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,4 +16,5 @@ FOUNDATION_EXPORT const unsigned char SDWebImageSwiftUIVersionString[];
|
||||||
|
|
||||||
// In this header, you should import all the public headers of your framework using statements like #import <SDWebImageSwiftUI/PublicHeader.h>
|
// In this header, you should import all the public headers of your framework using statements like #import <SDWebImageSwiftUI/PublicHeader.h>
|
||||||
#import <SDWebImageSwiftUI/SDAnimatedImageInterface.h>
|
#import <SDWebImageSwiftUI/SDAnimatedImageInterface.h>
|
||||||
|
#import <SDWebImageSwiftUI/SDAnimatedImageInterface+WebCache.h>
|
||||||
#import <SDWebImageSwiftUI/SDAnimatedImageInterfaceWrapper.h>
|
#import <SDWebImageSwiftUI/SDAnimatedImageInterfaceWrapper.h>
|
||||||
|
|
Loading…
Reference in New Issue