From bcb871a085b2f550ca5ff6f14600cf63340b3ccc Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sat, 5 Oct 2019 15:52:56 +0800 Subject: [PATCH] Update the readme about the animation control binding --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 290f42c..85ffa5f 100644 --- a/README.md +++ b/README.md @@ -85,20 +85,24 @@ var body: some View { ```swift var body: some View { Group { - AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif")) // Network + // Network + AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif")) .onFailure(perform: { (error) in // Error }) .scaledToFit() - AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp"))) // Data + // Data + AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp"))) .customLoopCount(1) - AnimatedImage(name: "animation1") // Bundle (not Asset Catalog) + // Bundle (not Asset Catalog) + AnimatedImage(name: "animation1", isAnimating: $isAnimating)) // Animation control binding .maxBufferSize(.max) } } ``` - [x] Supports network image as well as local data and bundle image +- [x] Supports animation control using the SwiftUI Binding - [x] Supports advanced control like loop count, incremental load, buffer size. 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.