From c25a22751078bd42d9ac69012196e4fbd131f13d Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Fri, 9 Aug 2019 16:15:44 +0800 Subject: [PATCH] Update the readme about the installation --- Example/Podfile.lock | 2 +- .../SDWebImageSwiftUIDemo/ContentView.swift | 1 + README.md | 23 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 698fc4c..e2e864c 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -18,7 +18,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: SDWebImage: fb387001955223213dde14bc08c8b73f371f8d8f - SDWebImageSwiftUI: 6ea3735551d25e99fdaaef00f8bcd20741e7ce95 + SDWebImageSwiftUI: 37af9cb22b2c4581e09a341d88ee96ba98c21c32 PODFILE CHECKSUM: 146734166216dd8fc1597433cc675999454ed4b2 diff --git a/Example/SDWebImageSwiftUIDemo/ContentView.swift b/Example/SDWebImageSwiftUIDemo/ContentView.swift index 31aacf8..34ecf9a 100644 --- a/Example/SDWebImageSwiftUIDemo/ContentView.swift +++ b/Example/SDWebImageSwiftUIDemo/ContentView.swift @@ -20,6 +20,7 @@ struct ContentView: View { AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif")!) // .scaledToFit() // Apple's Bug ? Custom UIView does not passthrough the `contentMode` from Swift UI layout system into UIKit layout system .frame(width: 400, height: 300, alignment: .center) + AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp"))) } } } diff --git a/README.md b/README.md index c5ed9cd..180bc2d 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ It aims to ensure the following function available for users and try to do some ## Installation +#### CocoaPods + SDWebImageSwiftUI is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile: @@ -32,6 +34,26 @@ it, simply add the following line to your Podfile: pod 'SDWebImageSwiftUI' ``` +#### Carthage + +SDWebImageSwiftUI is available through [Carthage](https://github.com/Carthage/Carthage). + +``` +github "dreampiggy/SDWebImageSwiftUI" +``` + +#### Swift Package Manager + +SDWebImageSwiftUI is available through [Swift Package Manager](https://swift.org/package-manager/). + +```swift +let package = Package( + dependencies: [ + .package(url: "https://github.com/dreampiggy/SDWebImageSwiftUI.git", .branch("master")) + ], +) +``` + ## Usage + Using `WebImage` to load network image @@ -51,6 +73,7 @@ var body: some View { ```swift var body: some View { AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif")!) + AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp"))) } ```