Skip to content

Commit cf0dc79

Browse files
authored
Merge pull request #292 from SDWebImage/example/avif
Update demo to add AVIF test images and AVIF animated images
2 parents c934a84 + 60bcf1e commit cf0dc79

File tree

6 files changed

+12
-3
lines changed

6 files changed

+12
-3
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
matrix:
4747
iosDestination: ["platform=iOS Simulator,name=iPhone 14 Pro"]
4848
tvOSDestination: ["platform=tvOS Simulator,name=Apple TV"]
49-
watchOSDestination: ["platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)"]
49+
watchOSDestination: ["platform=watchOS Simulator,os=10.0,name=Apple Watch Series 7 (45mm)"]
5050
macOSDestination: ["platform=macOS"]
5151
macCatalystDestination: ["platform=macOS,variant=Mac Catalyst"]
5252
steps:

Example/SDWebImageSwiftUI.xcodeproj/xcshareddata/xcschemes/SDWebImageSwiftUIDemo-watchOS WatchKit App.xcscheme

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
ignoresPersistentStateOnLaunch = "NO"
5454
debugDocumentVersioning = "YES"
5555
debugServiceExtension = "internal"
56-
allowLocationSimulation = "YES"
57-
notificationPayloadFile = "PushNotificationPayload.apns">
56+
allowLocationSimulation = "YES">
5857
<BuildableProductRunnable
5958
runnableDebuggingMode = "0">
6059
<BuildableReference

Example/SDWebImageSwiftUIDemo/AppDelegate.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import UIKit
1010
import SDWebImage
1111
import SDWebImageWebPCoder
12+
import SDWebImageAVIFCoder
1213
import SDWebImageSVGCoder
1314
import SDWebImagePDFCoder
1415

@@ -21,6 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2122
// Override point for customization after application launch.
2223
// Add WebP/SVG/PDF support
2324
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)
25+
SDImageCodersManager.shared.addCoder(SDImageAVIFCoder.shared)
2426
SDImageCodersManager.shared.addCoder(SDImageSVGCoder.shared)
2527
SDImageCodersManager.shared.addCoder(SDImagePDFCoder.shared)
2628
// Dynamic check to support vector format for both WebImage/AnimatedImage

Example/SDWebImageSwiftUIDemo/ContentView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ struct ContentView: View {
7373
"http://littlesvr.ca/apng/images/SteamEngine.webp",
7474
"http://littlesvr.ca/apng/images/world-cup-2014-42.webp",
7575
"https://isparta.github.io/compare-webp/image/gif_webp/webp/2.webp",
76+
"https://raw.githubusercontent.com/link-u/avif-sample-images/master/fox.profile0.8bpc.yuv420.avif",
77+
"https://raw.githubusercontent.com/link-u/avif-sample-images/master/star-12bpc-with-alpha.avifs",
7678
"https://nokiatech.github.io/heif/content/images/ski_jump_1440x960.heic",
7779
"https://nokiatech.github.io/heif/content/image_sequences/starfield_animation.heic",
7880
"https://nr-platform.s3.amazonaws.com/uploads/platform/published_extension/branding_icon/275/AmazonS3.png",

Podfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ def all_pods
66
pod 'SDWebImageWebPCoder'
77
pod 'SDWebImageSVGCoder'
88
pod 'SDWebImagePDFCoder'
9+
pod 'SDWebImageAVIFCoder'
10+
pod 'libavif', :subspecs => ['libdav1d']
911
end
1012

1113
def all_test_pods

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ The best place to put these setup code for SwiftUI App, it's the `AppDelegate.sw
303303
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
304304
// Add WebP/SVG/PDF support
305305
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)
306+
SDImageCodersManager.shared.addCoder(SDImageAVIFCoder.shared)
306307
SDImageCodersManager.shared.addCoder(SDImageSVGCoder.shared)
307308
SDImageCodersManager.shared.addCoder(SDImagePDFCoder.shared)
308309

@@ -478,6 +479,8 @@ struct MyApp: App {
478479
SDWebImageManager.defaultImageLoader = SDImageLoadersManager.shared
479480
// WebP support
480481
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)
482+
// AVIF support
483+
SDImageCodersManager.shared.addCoder(SDImageAVIFCoder.shared)
481484
}
482485

483486
var body: some Scene {
@@ -717,6 +720,7 @@ Which means, this project is one core use case and downstream dependency, which
717720

718721
- [SDWebImage](https://github.com/SDWebImage/SDWebImage)
719722
- [libwebp](https://github.com/SDWebImage/libwebp-Xcode)
723+
- [libavif](https://github.com/SDWebImage/libavif-Xcode)
720724
- [Kingfisher](https://github.com/onevcat/Kingfisher)
721725
- [SwiftUIX](https://github.com/SwiftUIX/SwiftUIX)
722726
- [Espera](https://github.com/JagCesar/Espera)

0 commit comments

Comments
 (0)