Skip to content

Commit 53b2420

Browse files
committed
Mark the API available for HEIC/AWebP coders, update the example
1 parent d09ff5a commit 53b2420

File tree

6 files changed

+18
-4
lines changed

6 files changed

+18
-4
lines changed

Examples/SDWebImage Demo/AppDelegate.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3333
// iOS 13 does not supports WebP, use third-party codec
3434
[[SDImageCodersManager sharedManager] addCoder:[SDImageWebPCoder sharedCoder]];
3535
}
36-
[[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]]; // For HEIC static/animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
36+
if (@available(iOS 13, tvOS 13, macOS 10.15, watchOS 6, *)) {
37+
// For HEIC animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
38+
[[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]];
39+
}
3740

3841
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
3942
// Override point for customization after application launch.

Examples/SDWebImage OSX Demo/AppDelegate.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
2626
// iOS 13 does not supports WebP, use third-party codec
2727
[[SDImageCodersManager sharedManager] addCoder:[SDImageWebPCoder sharedCoder]];
2828
}
29-
[[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]]; // For HEIC static/animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
29+
if (@available(iOS 13, tvOS 13, macOS 10.15, watchOS 6, *)) {
30+
// For HEIC animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
31+
[[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]];
32+
}
3033
}
3134

3235
- (void)applicationWillTerminate:(NSNotification *)aNotification {

Examples/SDWebImage TV Demo/AppDelegate.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2727
// iOS 13 does not supports WebP, use third-party codec
2828
[[SDImageCodersManager sharedManager] addCoder:[SDImageWebPCoder sharedCoder]];
2929
}
30-
[[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]]; // For HEIC static/animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
30+
if (@available(iOS 13, tvOS 13, macOS 10.15, watchOS 6, *)) {
31+
// For HEIC animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
32+
[[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]];
33+
}
3134

3235
return YES;
3336
}

Examples/SDWebImage Watch Demo Extension/ExtensionDelegate.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ - (void)applicationDidFinishLaunching {
2222
// iOS 13 does not supports WebP, use third-party codec
2323
[[SDImageCodersManager sharedManager] addCoder:[SDImageWebPCoder sharedCoder]];
2424
}
25-
[[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]]; // For HEIC static/animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
25+
if (@available(iOS 13, tvOS 13, macOS 10.15, watchOS 6, *)) {
26+
// For HEIC animated image. Animated image is new introduced in iOS 13, but it contains performance issue for now.
27+
[[SDImageCodersManager sharedManager] addCoder:[SDImageHEICCoder sharedCoder]];
28+
}
2629
}
2730

2831
- (void)applicationDidBecomeActive {

SDWebImage/Core/SDImageAWebPCoder.h

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
@note Currently Image/IO seems does not supports WebP encoding, if you need WebP encoding, use the custom codec below.
1616
@note If you need to support lower firmware version for WebP, you can have a try at https://github.com/SDWebImage/SDWebImageWebPCoder
1717
*/
18+
API_AVAILABLE(ios(14.0), tvos(14.0), macos(11.0), watchos(7.0))
1819
@interface SDImageAWebPCoder : SDImageIOAnimatedCoder <SDProgressiveImageCoder, SDAnimatedImageCoder>
1920

2021
@property (nonatomic, class, readonly, nonnull) SDImageAWebPCoder *sharedCoder;

SDWebImage/Core/SDImageHEICCoder.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
@note This coder is not in the default coder list for now, since HEIC animated image is really rare, and Apple's implementation still contains performance issues. You can enable if you need this.
1818
@note If you need to support lower firmware version for HEIF, you can have a try at https://github.com/SDWebImage/SDWebImageHEIFCoder
1919
*/
20+
API_AVAILABLE(ios(13.0), tvos(13.0), macos(10.15), watchos(6.0))
2021
@interface SDImageHEICCoder : SDImageIOAnimatedCoder <SDProgressiveImageCoder, SDAnimatedImageCoder>
2122

2223
@property (nonatomic, class, readonly, nonnull) SDImageHEICCoder *sharedCoder;

0 commit comments

Comments
 (0)