Update the readme about the installation

This commit is contained in:
DreamPiggy 2019-08-09 16:15:44 +08:00
parent 7c6a74c7f4
commit c25a227510
3 changed files with 25 additions and 1 deletions

View File

@ -18,7 +18,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
SDWebImage: fb387001955223213dde14bc08c8b73f371f8d8f
SDWebImageSwiftUI: 6ea3735551d25e99fdaaef00f8bcd20741e7ce95
SDWebImageSwiftUI: 37af9cb22b2c4581e09a341d88ee96ba98c21c32
PODFILE CHECKSUM: 146734166216dd8fc1597433cc675999454ed4b2

View File

@ -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")))
}
}
}

View File

@ -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")))
}
```