Skip to content

Commit 7d6e2f3

Browse files
committed
Update the readme with the advanced control for AnimatedImage
1 parent d86904f commit 7d6e2f3

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ let package = Package(
6161

6262
## Usage
6363

64-
+ Using `WebImage` to load network image
64+
### Using `WebImage` to load network image
6565

66-
Supports the placeholder and detail options control for image loading as SDWebImage.
67-
68-
Supports the success/failure/progress changes event for custom handling.
66+
- [x] Supports the placeholder and detail options control for image loading as SDWebImage.
67+
- [x] Supports the success/failure/progress changes event for custom handling.
6968

7069
Note: Unlike `UIImageView` in UIKit, SwiftUI's `Image` does not support animation. This `WebImage` using `Image` for internal implementation and supports static image format only.
7170

@@ -81,20 +80,25 @@ var body: some View {
8180
}
8281
```
8382

84-
+ Using `AnimatedImage` to play animation
83+
### Using `AnimatedImage` to play animation
8584

8685
```swift
8786
var body: some View {
88-
AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif"))
89-
.onFailure(perform: { (error) in
90-
// Error
91-
})
92-
.scaledToFit()
93-
AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp")))
94-
.scaledToFill()
87+
Group {
88+
AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif"))
89+
.onFailure(perform: { (error) in
90+
// Error
91+
})
92+
.scaledToFit()
93+
AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp")))
94+
.customLoopCount(1)
95+
}
9596
}
9697
```
9798

99+
- [x] Supports network image as well as local data and bundle image
100+
- [x] Supports advanced control like loop count, incremental load, buffer size.
101+
98102
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.
99103

100104
## Demo

0 commit comments

Comments
 (0)