Skip to content

Commit d624d04

Browse files
committed
Update the readme with different indicator and transition API for WebImage/AnimatedImage
1 parent 7b5f7b8 commit d624d04

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Example/SDWebImageSwiftUIDemo/ContentView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ struct ContentView: View {
9898
WebImage(url: URL(string:url))
9999
.resizable()
100100
.indicator(.activity)
101-
.scaledToFit()
102-
.frame(width: CGFloat(100), height: CGFloat(100), alignment: .center)
103101
.animation(.easeInOut(duration: 0.5))
104102
.transition(.fade)
103+
.scaledToFit()
104+
.frame(width: CGFloat(100), height: CGFloat(100), alignment: .center)
105105
#else
106106
WebImage(url: URL(string:url))
107107
.resizable()

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ let package = Package(
6464
- [x] Supports placeholder and detail options control for image loading as SDWebImage
6565
- [x] Supports success/failure/progress changes event for custom handling
6666
- [x] Supports indicator with activity/progress indicator and customization
67+
- [x] Supports built-in animation and transition, powered by SwiftUI
6768

6869
Note: This `WebImage` using `Image` for internal implementation, which is the best compatible for SwiftUI layout and animation system. But it supports static image format only, because unlike `UIImageView` in UIKit, SwiftUI's `Image` does not support animation.
6970

@@ -75,6 +76,8 @@ var body: some View {
7576
}
7677
.resizable()
7778
.indicator(.activity) // Activity Indicator
79+
.animation(.easeInOut(duration: 0.5))
80+
.transition(.fade) // Fade Transition
7881
.scaledToFit()
7982
.frame(width: 300, height: 300, alignment: .center)
8083
}
@@ -90,6 +93,7 @@ var body: some View {
9093
.onFailure { error in
9194
// Error
9295
}
96+
.indicator(SDWebImageActivityIndicator.medium) // Activity Indicator
9397
.transition(.fade) // Fade Transition
9498
.scaledToFit()
9599
// Data
@@ -104,7 +108,7 @@ var body: some View {
104108

105109
- [x] Supports network image as well as local data and bundle image
106110
- [x] Supports animation control using the SwiftUI Binding
107-
- [x] Supports indicator and transition powered by SDWebImage and CoreAnimation
111+
- [x] Supports indicator and transition powered by SDWebImage and CoreAnimation API
108112
- [x] Supports advanced control like loop count, incremental load, buffer size
109113
- [x] Supports coordinate with native UIKit/AppKit/WKInterface view
110114

0 commit comments

Comments
 (0)