parent
e9c28e59ce
commit
269a150dff
|
@ -26,6 +26,7 @@ Note we do not guarantee the public API stable for current status. Since SwiftUI
|
||||||
+ macOS 10.15+
|
+ macOS 10.15+
|
||||||
+ tvOS 13+
|
+ tvOS 13+
|
||||||
+ watchOS 6+
|
+ watchOS 6+
|
||||||
|
+ Swift 5.1+
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
@ -64,9 +65,12 @@ let package = Package(
|
||||||
|
|
||||||
It supports the placeholder and detail options control for image loading as SDWebImage.
|
It supports the placeholder and detail options control for image loading as SDWebImage.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
var body: some View {
|
var body: some View {
|
||||||
WebImage(url: URL(string: "https://nokiatech.github.io/heif/content/images/ski_jump_1440x960.heic"))
|
WebImage(url: URL(string: "https://nokiatech.github.io/heif/content/images/ski_jump_1440x960.heic"))
|
||||||
|
.resizable()
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.frame(width: 300, height: 300, alignment: .center)
|
.frame(width: 300, height: 300, alignment: .center)
|
||||||
}
|
}
|
||||||
|
@ -77,11 +81,13 @@ var body: some View {
|
||||||
```swift
|
```swift
|
||||||
var body: some View {
|
var body: some View {
|
||||||
AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif"))
|
AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif"))
|
||||||
|
.scaledToFit()
|
||||||
AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp")))
|
AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp")))
|
||||||
|
.scaledToFill()
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
It 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.
|
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.
|
||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = 'SDWebImageSwiftUI'
|
s.name = 'SDWebImageSwiftUI'
|
||||||
s.version = '0.1.1'
|
s.version = '0.1.2'
|
||||||
s.summary = 'Integration of SDWebImage Asynchronous image loading and SwiftUI framework'
|
s.summary = 'Integration of SDWebImage Asynchronous image loading and SwiftUI framework'
|
||||||
|
|
||||||
s.description = <<-DESC
|
s.description = <<-DESC
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.1.1</string>
|
<string>0.1.2</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
Loading…
Reference in New Issue