Skip to content

Commit e8c5d44

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 8526cff + 88f2d67 commit e8c5d44

23 files changed

+452
-532
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: swift
2-
osx_image: xcode11.4
2+
osx_image: xcode12
33

44
env:
55
global:
@@ -33,8 +33,8 @@ script:
3333
- pod install --project-directory=Example
3434
- xcodebuild build -workspace Example/SDWebImageSwiftUI.xcworkspace -scheme SDWebImageSwiftUIDemo -destination 'name=iPhone 11 Pro Max' -configuration Debug | xcpretty -c
3535

36-
- carthage update --configuration Debug
37-
- xcodebuild build -project SDWebImageSwiftUI.xcodeproj -scheme 'SDWebImageSwiftUI' -sdk iphonesimulator -configuration Debug | xcpretty -c
36+
- ./carthage.sh update --configuration Debug
37+
- xcodebuild build -project SDWebImageSwiftUI.xcodeproj -scheme 'SDWebImageSwiftUI' -destination 'name=iPhone 11 Pro Max' -configuration Debug | xcpretty -c
3838

3939
- echo Clean DerivedData
4040
- rm -rf ~/Library/Developer/Xcode/DerivedData/

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [2.0.1] - 2021-02-25
10+
### Fixed
11+
- Fix the rare cases that WebImage will lost animation when visibility changes. #171
12+
13+
## [2.0.0] - 2021-02-23
14+
### Added
15+
- Update with the playbackMode support for `WebImage` and `AnimatedImage` #168
16+
- Update watchOS demo to watchOS 7, remove the custom indicator sample and use `ProgressView` instead #166
17+
- Update the Example to make WebImage animatable by default #160
18+
19+
### Fixed
20+
- Fix the issue sometime the `WebImage` appear/disappear logic wrong. Using UIKit/AppKit to detect the visibility #164
21+
- Fix the leak of WebImage with animation and NavigationLink. #163
22+
- Try to fix the recursive updateView when using AnimatedImage inside `ScrollView/LazyVStack`. Which cause App freeze #162
23+
- Remove the fix for EXIF image in WebImage, which is fixed by Apple in iOS 14 #159
24+
25+
### Changed
26+
- Bump the limit to Xcode 12, because we need new iOS 14+ APIs check #167
27+
- Update the WebImage to defaults animatable #165
28+
29+
### Removed
30+
- Remove the wrong design onSuccess API. Using the full params one instead #169
31+
932
## [1.5.0] - 2020-06-01
1033
### Added
1134
- Add the convenient API support to use SwiftUI transition with ease-in-out duration #116

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "SDWebImage/SDWebImage" ~> 5.7
1+
github "SDWebImage/SDWebImage" ~> 5.10

Example/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ target 'SDWebImageSwiftUIDemo-tvOS' do
2323
end
2424

2525
target 'SDWebImageSwiftUIDemo-watchOS WatchKit Extension' do
26-
platform :watchos, '6.0'
26+
platform :watchos, '7.0'
2727
all_pods
2828
end

Example/SDWebImageSwiftUI.xcodeproj/project.pbxproj

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
320CDC3222FADB45007CF858 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 320CDC3122FADB45007CF858 /* Assets.xcassets */; };
1515
320CDC3522FADB45007CF858 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 320CDC3422FADB45007CF858 /* Preview Assets.xcassets */; };
1616
320CDC3822FADB45007CF858 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 320CDC3622FADB45007CF858 /* LaunchScreen.storyboard */; };
17-
3243598423E05C3D006DF9C5 /* Espera.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3243598323E05C3D006DF9C5 /* Espera.swift */; };
18-
3243598523E05C3D006DF9C5 /* Espera.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3243598323E05C3D006DF9C5 /* Espera.swift */; };
19-
3243598623E05C3D006DF9C5 /* Espera.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3243598323E05C3D006DF9C5 /* Espera.swift */; };
20-
3243598723E05C3D006DF9C5 /* Espera.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3243598323E05C3D006DF9C5 /* Espera.swift */; };
2117
326B0D712345C01900D28269 /* DetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 326B0D702345C01900D28269 /* DetailView.swift */; };
2218
32E5290C2348A0C700EA46FF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32E5290B2348A0C700EA46FF /* AppDelegate.swift */; };
2319
32E529102348A0C900EA46FF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32E5290F2348A0C900EA46FF /* Assets.xcassets */; };
@@ -98,7 +94,6 @@
9894
320CDC3422FADB45007CF858 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
9995
320CDC3722FADB45007CF858 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
10096
320CDC3922FADB45007CF858 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
101-
3243598323E05C3D006DF9C5 /* Espera.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Espera.swift; sourceTree = "<group>"; };
10297
326B0D702345C01900D28269 /* DetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailView.swift; sourceTree = "<group>"; };
10398
32E529092348A0C700EA46FF /* SDWebImageSwiftUIDemo-macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SDWebImageSwiftUIDemo-macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
10499
32E5290B2348A0C700EA46FF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@@ -212,7 +207,6 @@
212207
320CDC2D22FADB44007CF858 /* SceneDelegate.swift */,
213208
320CDC2F22FADB44007CF858 /* ContentView.swift */,
214209
326B0D702345C01900D28269 /* DetailView.swift */,
215-
3243598323E05C3D006DF9C5 /* Espera.swift */,
216210
320CDC3122FADB45007CF858 /* Assets.xcassets */,
217211
320CDC3622FADB45007CF858 /* LaunchScreen.storyboard */,
218212
320CDC3922FADB45007CF858 /* Info.plist */,
@@ -792,7 +786,6 @@
792786
320CDC2C22FADB44007CF858 /* AppDelegate.swift in Sources */,
793787
326B0D712345C01900D28269 /* DetailView.swift in Sources */,
794788
320CDC2E22FADB44007CF858 /* SceneDelegate.swift in Sources */,
795-
3243598423E05C3D006DF9C5 /* Espera.swift in Sources */,
796789
320CDC3022FADB44007CF858 /* ContentView.swift in Sources */,
797790
);
798791
runOnlyForDeploymentPostprocessing = 0;
@@ -804,7 +797,6 @@
804797
32E529622348A10B00EA46FF /* ContentView.swift in Sources */,
805798
32E529632348A10B00EA46FF /* DetailView.swift in Sources */,
806799
32E5290C2348A0C700EA46FF /* AppDelegate.swift in Sources */,
807-
3243598523E05C3D006DF9C5 /* Espera.swift in Sources */,
808800
);
809801
runOnlyForDeploymentPostprocessing = 0;
810802
};
@@ -815,7 +807,6 @@
815807
32E529652348A10B00EA46FF /* ContentView.swift in Sources */,
816808
32E529662348A10B00EA46FF /* DetailView.swift in Sources */,
817809
32E529232348A0D300EA46FF /* AppDelegate.swift in Sources */,
818-
3243598623E05C3D006DF9C5 /* Espera.swift in Sources */,
819810
);
820811
runOnlyForDeploymentPostprocessing = 0;
821812
};
@@ -826,7 +817,6 @@
826817
32E5294E2348A0DE00EA46FF /* HostingController.swift in Sources */,
827818
32E529692348A10C00EA46FF /* DetailView.swift in Sources */,
828819
32E529502348A0DE00EA46FF /* ExtensionDelegate.swift in Sources */,
829-
3243598723E05C3D006DF9C5 /* Espera.swift in Sources */,
830820
32E529682348A10C00EA46FF /* ContentView.swift in Sources */,
831821
);
832822
runOnlyForDeploymentPostprocessing = 0;
@@ -1102,7 +1092,7 @@
11021092
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
11031093
SWIFT_VERSION = 5.0;
11041094
TARGETED_DEVICE_FAMILY = 4;
1105-
WATCHOS_DEPLOYMENT_TARGET = 6.0;
1095+
WATCHOS_DEPLOYMENT_TARGET = 7.0;
11061096
};
11071097
name = Debug;
11081098
};
@@ -1132,7 +1122,7 @@
11321122
SKIP_INSTALL = YES;
11331123
SWIFT_VERSION = 5.0;
11341124
TARGETED_DEVICE_FAMILY = 4;
1135-
WATCHOS_DEPLOYMENT_TARGET = 6.0;
1125+
WATCHOS_DEPLOYMENT_TARGET = 7.0;
11361126
};
11371127
name = Release;
11381128
};
@@ -1163,7 +1153,7 @@
11631153
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
11641154
SWIFT_VERSION = 5.0;
11651155
TARGETED_DEVICE_FAMILY = 4;
1166-
WATCHOS_DEPLOYMENT_TARGET = 6.0;
1156+
WATCHOS_DEPLOYMENT_TARGET = 7.0;
11671157
};
11681158
name = Debug;
11691159
};
@@ -1191,7 +1181,7 @@
11911181
SKIP_INSTALL = YES;
11921182
SWIFT_VERSION = 5.0;
11931183
TARGETED_DEVICE_FAMILY = 4;
1194-
WATCHOS_DEPLOYMENT_TARGET = 6.0;
1184+
WATCHOS_DEPLOYMENT_TARGET = 7.0;
11951185
};
11961186
name = Release;
11971187
};
@@ -1217,6 +1207,7 @@
12171207
PRODUCT_NAME = "$(TARGET_NAME)";
12181208
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
12191209
SWIFT_VERSION = 5.0;
1210+
WATCHOS_DEPLOYMENT_TARGET = 7.0;
12201211
};
12211212
name = Debug;
12221213
};
@@ -1239,6 +1230,7 @@
12391230
PRODUCT_BUNDLE_IDENTIFIER = "com.dreampiggy.SDWebImageSwiftUIDemo-watchOS";
12401231
PRODUCT_NAME = "$(TARGET_NAME)";
12411232
SWIFT_VERSION = 5.0;
1233+
WATCHOS_DEPLOYMENT_TARGET = 7.0;
12421234
};
12431235
name = Release;
12441236
};
@@ -1287,7 +1279,6 @@
12871279
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
12881280
GCC_WARN_UNUSED_FUNCTION = YES;
12891281
GCC_WARN_UNUSED_VARIABLE = YES;
1290-
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
12911282
MTL_ENABLE_DEBUG_INFO = YES;
12921283
ONLY_ACTIVE_ARCH = YES;
12931284
SDKROOT = iphoneos;
@@ -1333,7 +1324,6 @@
13331324
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
13341325
GCC_WARN_UNUSED_FUNCTION = YES;
13351326
GCC_WARN_UNUSED_VARIABLE = YES;
1336-
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
13371327
MTL_ENABLE_DEBUG_INFO = NO;
13381328
SDKROOT = iphoneos;
13391329
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";

Example/SDWebImageSwiftUIDemo/ContentView.swift

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,48 +18,17 @@ class UserSettings: ObservableObject {
1818
}
1919

2020
#if os(watchOS)
21-
// watchOS does not provide built-in indicator, use Espera's custom indicator
22-
struct ActivityIndicator : View {
23-
@Binding var isAnimating: Bool
24-
var body: some View {
25-
if isAnimating {
26-
return AnyView(LoadingFlowerView()
27-
.frame(width: 30, height: 30))
28-
} else {
29-
return AnyView(EmptyView()
30-
.frame(width: 30, height: 30))
31-
}
32-
}
33-
}
34-
35-
struct ProgressIndicator : View {
36-
@Binding var isAnimating: Bool
37-
@Binding var progress: Double
38-
var body: some View {
39-
if isAnimating {
40-
return AnyView(StretchProgressView(progress: $progress)
41-
.frame(width: 140, height: 10))
42-
} else {
43-
return AnyView(EmptyView()
44-
.frame(width: 140, height: 10))
45-
}
46-
}
47-
}
48-
49-
extension Indicator where T == ActivityIndicator {
50-
/// Activity Indicator
21+
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
22+
extension Indicator where T == ProgressView<EmptyView, EmptyView> {
5123
static var activity: Indicator {
52-
Indicator { isAnimating, _ in
53-
ActivityIndicator(isAnimating: isAnimating)
24+
Indicator { isAnimating, progress in
25+
ProgressView()
5426
}
5527
}
56-
}
57-
58-
extension Indicator where T == ProgressIndicator {
59-
/// Progress Indicator
28+
6029
static var progress: Indicator {
6130
Indicator { isAnimating, progress in
62-
ProgressIndicator(isAnimating: isAnimating, progress: progress)
31+
ProgressView(value: progress.wrappedValue)
6332
}
6433
}
6534
}
@@ -155,7 +124,7 @@ struct ContentView: View {
155124
HStack {
156125
if self.animated {
157126
#if os(macOS) || os(iOS) || os(tvOS)
158-
AnimatedImage(url: URL(string:url))
127+
AnimatedImage(url: URL(string:url), isAnimating: .constant(true))
159128
.onViewUpdate { view, context in
160129
#if os(macOS)
161130
view.toolTip = url
@@ -178,7 +147,7 @@ struct ContentView: View {
178147
.frame(width: CGFloat(100), height: CGFloat(100), alignment: .center)
179148
#endif
180149
} else {
181-
WebImage(url: URL(string:url))
150+
WebImage(url: URL(string:url), isAnimating: .constant(true))
182151
.resizable()
183152
/**
184153
.placeholder {

Example/SDWebImageSwiftUIDemo/DetailView.swift

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extension Image {
3636

3737
struct DetailView: View {
3838
let url: String
39-
let animated: Bool
39+
@State var animated: Bool = true // You can change between WebImage/AnimatedImage
4040
@State var isAnimating: Bool = true
4141
@State var lastScale: CGFloat = 1.0
4242
@State var scale: CGFloat = 1.0
@@ -45,25 +45,17 @@ struct DetailView: View {
4545
var body: some View {
4646
VStack {
4747
#if os(iOS) || os(tvOS)
48-
if animated {
49-
zoomView()
50-
.navigationBarItems(trailing: Button(isAnimating ? "Stop" : "Start") {
51-
self.isAnimating.toggle()
52-
})
53-
} else {
54-
zoomView()
55-
}
48+
zoomView()
49+
.navigationBarItems(trailing: Button(isAnimating ? "Stop" : "Start") {
50+
self.isAnimating.toggle()
51+
})
5652
#endif
5753
#if os(macOS) || os(watchOS)
58-
if animated {
59-
zoomView()
60-
.contextMenu {
61-
Button(isAnimating ? "Stop" : "Start") {
62-
self.isAnimating.toggle()
63-
}
54+
zoomView()
55+
.contextMenu {
56+
Button(isAnimating ? "Stop" : "Start") {
57+
self.isAnimating.toggle()
6458
}
65-
} else {
66-
zoomView()
6759
}
6860
#endif
6961
}
@@ -116,7 +108,7 @@ struct DetailView: View {
116108
.scaledToFit()
117109
#endif
118110
} else {
119-
WebImage(url: URL(string:url), options: [.progressiveLoad, .delayPlaceholder])
111+
WebImage(url: URL(string:url), options: [.progressiveLoad, .delayPlaceholder], isAnimating: $isAnimating)
120112
.resizable()
121113
.placeholder(.wifiExclamationmark)
122114
.indicator(.progress)

0 commit comments

Comments
 (0)