You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-8Lines changed: 20 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ SDWebImageSwiftUI is a SwiftUI image loading framework, which based on [SDWebIma
13
13
14
14
It brings all your favorite features from SDWebImage, like async image loading, memory/disk caching, animated image playback and performances.
15
15
16
+
Since it based on SDWebImage, you can get all benefits from the existing community. You can have massive image format support (GIF/APNG/WebP/HEICS/AVIF...) via [Coder Plugins](https://github.com/SDWebImage/SDWebImage/wiki/Coder-Plugin-List), PhotoKit support via [SDWebImagePhotosPlugin](https://github.com/SDWebImage/SDWebImagePhotosPlugin), Firebase integration via [FirebaseUI](https://github.com/firebase/FirebaseUI-iOS), etc.
17
+
16
18
Besides all these features, we do optimization for SwiftUI, like Binding, View Modifier, using the same design pattern to become a good SwiftUI citizen.
17
19
18
20
Note we do not guarantee the public API stable for current status until v1.0 version. Since SwiftUI is a new platform for us. This framework is under development, feature requests, contributions, and GitHub stars are welcomed.
@@ -66,8 +68,6 @@ let package = Package(
66
68
-[x] Supports indicator with activity/progress indicator and customization
67
69
-[x] Supports built-in animation and transition, powered by SwiftUI
68
70
69
-
Note: This `WebImage` using `Image` for internal implementation, which is the best compatible for SwiftUI layout and animation system. But it supports static image format only, because unlike `UIImageView` in UIKit, SwiftUI's `Image` does not support animation.
Note: This `WebImage` using `Image` for internal implementation, which is the best compatible for SwiftUI layout and animation system. But it supports static image format only, because unlike `UIImageView` in UIKit, SwiftUI's `Image` does not support animation.
87
+
86
88
### Using `AnimatedImage` to play animation
87
89
90
+
-[x] Supports network image as well as local data and bundle image
91
+
-[x] Supports animation control using the SwiftUI Binding
92
+
-[x] Supports indicator and transition, powered by SDWebImage and Core Animation
93
+
-[x] Supports advanced control like loop count, incremental load, buffer size
94
+
-[x] Supports coordinate with native UIKit/AppKit/WatchKit view
95
+
88
96
```swift
89
97
var body: some View {
90
98
Group {
@@ -107,16 +115,20 @@ var body: some View {
107
115
}
108
116
```
109
117
110
-
-[x] Supports network image as well as local data and bundle image
111
-
-[x] Supports animation control using the SwiftUI Binding
112
-
-[x] Supports indicator and transition, powered by SDWebImage and Core Animation
113
-
-[x] Supports advanced control like loop count, incremental load, buffer size
114
-
-[x] Supports coordinate with native UIKit/AppKit/WatchKit view
115
-
116
118
Note: `AnimatedImage` supports both image url or image data for animated image format. Which use the SDWebImage's [Animated ImageView](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) for internal implementation. Pay attention that since this base on UIKit/AppKit representable, some advanced SwiftUI layout and animation system may not work as expected. You may need UIKit/AppKit and Core Animation to modify the native view.
117
119
118
120
Note: From v0.4.0, `AnimatedImage` supports watchOS as well. However, it's not backed by SDWebImage's [Animated ImageView](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) like iOS/tvOS/macOS. It use some tricks and hacks because of the limitation on current Apple's API. It also use Image/IO decoding system, which means it supports GIF and APNG format only, but not external format like WebP.
119
121
122
+
## Which View to choose
123
+
124
+
Why we have two different View types here, is because of current SwiftUI limitation, and we want to beyond that, to provide best solution for both usage.
125
+
126
+
If you don't need animated image, prefer to use `WebImage` firstly. Which behaves the seamless as built-in SwiftUI View. It SwiftUI works, it works.
127
+
128
+
If you need animated image, `AnimatedImage` is the only one to choose. Remember it supports static image as well, you don't need to check the url format, just use as it.
129
+
130
+
But, because `AnimatedImage` use `UIViewRepresentable` and driven by UIKit, currently there may be some small incompatible issues between UIKit and SwiftUI layout and animation system. We try our best to match SwiftUI behavior, and provide the same API as `WebImage`, which make it easy to switch between these two types.
131
+
120
132
## Demo
121
133
122
134
To run the example using SwiftUI, following the steps:
0 commit comments