Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5622af5

Browse files
authoredSep 2, 2023
Merge pull request #250 from SDWebImage/drop_ios_13
Drop iOS 13/macOS 10.15/tvOS 13/watchOS 6 support
2 parents e837c37 + 7db63ed commit 5622af5

25 files changed

+117
-929
lines changed
 

‎Example/SDWebImageSwiftUI.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@
1515
320CDC3222FADB45007CF858 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 320CDC3122FADB45007CF858 /* Assets.xcassets */; };
1616
320CDC3522FADB45007CF858 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 320CDC3422FADB45007CF858 /* Preview Assets.xcassets */; };
1717
320CDC3822FADB45007CF858 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 320CDC3622FADB45007CF858 /* LaunchScreen.storyboard */; };
18-
322E0DF728D331A20003A55F /* IndicatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF028D331A20003A55F /* IndicatorTests.swift */; };
1918
322E0DF828D331A20003A55F /* WebImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF128D331A20003A55F /* WebImageTests.swift */; };
2019
322E0DF928D331A20003A55F /* Images.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 322E0DF228D331A20003A55F /* Images.bundle */; };
2120
322E0DFA28D331A20003A55F /* ImageManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF328D331A20003A55F /* ImageManagerTests.swift */; };
2221
322E0DFB28D331A20003A55F /* AnimatedImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF428D331A20003A55F /* AnimatedImageTests.swift */; };
2322
322E0DFD28D331A20003A55F /* TestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF628D331A20003A55F /* TestUtils.swift */; };
2423
322E0E1828D3320D0003A55F /* ImageManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF328D331A20003A55F /* ImageManagerTests.swift */; };
25-
322E0E1928D3320D0003A55F /* IndicatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF028D331A20003A55F /* IndicatorTests.swift */; };
2624
322E0E1A28D3320D0003A55F /* WebImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF128D331A20003A55F /* WebImageTests.swift */; };
2725
322E0E1B28D3320D0003A55F /* AnimatedImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF428D331A20003A55F /* AnimatedImageTests.swift */; };
2826
322E0E1C28D3320D0003A55F /* TestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF628D331A20003A55F /* TestUtils.swift */; };
2927
322E0E1D28D3320D0003A55F /* ImageManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF328D331A20003A55F /* ImageManagerTests.swift */; };
30-
322E0E1E28D3320D0003A55F /* IndicatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF028D331A20003A55F /* IndicatorTests.swift */; };
3128
322E0E1F28D3320D0003A55F /* WebImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF128D331A20003A55F /* WebImageTests.swift */; };
3229
322E0E2028D3320D0003A55F /* AnimatedImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF428D331A20003A55F /* AnimatedImageTests.swift */; };
3330
322E0E2128D3320D0003A55F /* TestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322E0DF628D331A20003A55F /* TestUtils.swift */; };
@@ -142,7 +139,6 @@
142139
320CDC3722FADB45007CF858 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
143140
320CDC3922FADB45007CF858 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
144141
322E0DE628D3318B0003A55F /* SDWebImageSwiftUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SDWebImageSwiftUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
145-
322E0DF028D331A20003A55F /* IndicatorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IndicatorTests.swift; sourceTree = "<group>"; };
146142
322E0DF128D331A20003A55F /* WebImageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebImageTests.swift; sourceTree = "<group>"; };
147143
322E0DF228D331A20003A55F /* Images.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Images.bundle; sourceTree = "<group>"; };
148144
322E0DF328D331A20003A55F /* ImageManagerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageManagerTests.swift; sourceTree = "<group>"; };
@@ -323,7 +319,6 @@
323319
322E0DEF28D331A20003A55F /* Tests */ = {
324320
isa = PBXGroup;
325321
children = (
326-
322E0DF028D331A20003A55F /* IndicatorTests.swift */,
327322
322E0DF128D331A20003A55F /* WebImageTests.swift */,
328323
322E0DF228D331A20003A55F /* Images.bundle */,
329324
322E0DF328D331A20003A55F /* ImageManagerTests.swift */,
@@ -1159,7 +1154,6 @@
11591154
322E0DF828D331A20003A55F /* WebImageTests.swift in Sources */,
11601155
322E0DFD28D331A20003A55F /* TestUtils.swift in Sources */,
11611156
322E0DFB28D331A20003A55F /* AnimatedImageTests.swift in Sources */,
1162-
322E0DF728D331A20003A55F /* IndicatorTests.swift in Sources */,
11631157
322E0DFA28D331A20003A55F /* ImageManagerTests.swift in Sources */,
11641158
);
11651159
runOnlyForDeploymentPostprocessing = 0;
@@ -1172,7 +1166,6 @@
11721166
322E0E1A28D3320D0003A55F /* WebImageTests.swift in Sources */,
11731167
322E0E1828D3320D0003A55F /* ImageManagerTests.swift in Sources */,
11741168
322E0E1C28D3320D0003A55F /* TestUtils.swift in Sources */,
1175-
322E0E1928D3320D0003A55F /* IndicatorTests.swift in Sources */,
11761169
);
11771170
runOnlyForDeploymentPostprocessing = 0;
11781171
};
@@ -1184,7 +1177,6 @@
11841177
322E0E1F28D3320D0003A55F /* WebImageTests.swift in Sources */,
11851178
322E0E1D28D3320D0003A55F /* ImageManagerTests.swift in Sources */,
11861179
322E0E2128D3320D0003A55F /* TestUtils.swift in Sources */,
1187-
322E0E1E28D3320D0003A55F /* IndicatorTests.swift in Sources */,
11881180
);
11891181
runOnlyForDeploymentPostprocessing = 0;
11901182
};

‎Example/SDWebImageSwiftUI.xcodeproj/xcshareddata/xcschemes/SDWebImageSwiftUIDemo-watchOS WatchKit App.xcscheme

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,46 +54,33 @@
5454
debugDocumentVersioning = "YES"
5555
debugServiceExtension = "internal"
5656
allowLocationSimulation = "YES">
57-
<RemoteRunnable
58-
runnableDebuggingMode = "2"
59-
BundleIdentifier = "com.apple.Carousel"
60-
RemotePath = "/SDWebImageSwiftUIDemo-watchOS WatchKit App">
57+
<BuildableProductRunnable
58+
runnableDebuggingMode = "0">
6159
<BuildableReference
6260
BuildableIdentifier = "primary"
6361
BlueprintIdentifier = "32E529362348A0DD00EA46FF"
6462
BuildableName = "SDWebImageSwiftUIDemo-watchOS WatchKit App.app"
6563
BlueprintName = "SDWebImageSwiftUIDemo-watchOS WatchKit App"
6664
ReferencedContainer = "container:SDWebImageSwiftUI.xcodeproj">
6765
</BuildableReference>
68-
</RemoteRunnable>
66+
</BuildableProductRunnable>
6967
</LaunchAction>
7068
<ProfileAction
7169
buildConfiguration = "Release"
7270
shouldUseLaunchSchemeArgsEnv = "YES"
7371
savedToolIdentifier = ""
7472
useCustomWorkingDirectory = "NO"
7573
debugDocumentVersioning = "YES">
76-
<RemoteRunnable
77-
runnableDebuggingMode = "2"
78-
BundleIdentifier = "com.apple.Carousel"
79-
RemotePath = "/SDWebImageSwiftUIDemo-watchOS WatchKit App">
74+
<BuildableProductRunnable
75+
runnableDebuggingMode = "0">
8076
<BuildableReference
8177
BuildableIdentifier = "primary"
8278
BlueprintIdentifier = "32E529362348A0DD00EA46FF"
8379
BuildableName = "SDWebImageSwiftUIDemo-watchOS WatchKit App.app"
8480
BlueprintName = "SDWebImageSwiftUIDemo-watchOS WatchKit App"
8581
ReferencedContainer = "container:SDWebImageSwiftUI.xcodeproj">
8682
</BuildableReference>
87-
</RemoteRunnable>
88-
<MacroExpansion>
89-
<BuildableReference
90-
BuildableIdentifier = "primary"
91-
BlueprintIdentifier = "32E529362348A0DD00EA46FF"
92-
BuildableName = "SDWebImageSwiftUIDemo-watchOS WatchKit App.app"
93-
BlueprintName = "SDWebImageSwiftUIDemo-watchOS WatchKit App"
94-
ReferencedContainer = "container:SDWebImageSwiftUI.xcodeproj">
95-
</BuildableReference>
96-
</MacroExpansion>
83+
</BuildableProductRunnable>
9784
</ProfileAction>
9885
<AnalyzeAction
9986
buildConfiguration = "Debug">

‎Example/SDWebImageSwiftUIDemo/ContentView.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,6 @@ class UserSettings: ObservableObject {
1717
#endif
1818
}
1919

20-
#if os(watchOS)
21-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
22-
extension Indicator where T == ProgressView<EmptyView, EmptyView> {
23-
static var activity: Indicator {
24-
Indicator { isAnimating, progress in
25-
ProgressView()
26-
}
27-
}
28-
29-
static var progress: Indicator {
30-
Indicator { isAnimating, progress in
31-
ProgressView(value: progress.wrappedValue)
32-
}
33-
}
34-
}
35-
#endif
36-
3720
// Test Switching url using @State
3821
struct ContentView2: View {
3922
@State var imageURLs = [

‎Example/SDWebImageSwiftUIDemo/DetailView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ struct DetailView: View {
111111
WebImage(url: URL(string:url), options: [.progressiveLoad, .delayPlaceholder], isAnimating: $isAnimating)
112112
.resizable()
113113
.placeholder(.wifiExclamationmark)
114-
.indicator(.progress)
114+
.indicator(.progress(style: .circular))
115115
.scaledToFit()
116116
}
117117
}

‎Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// swift-tools-version:5.2
1+
// swift-tools-version:5.3
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "SDWebImageSwiftUI",
88
platforms: [
9-
.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)
9+
.macOS(.v11), .iOS(.v14), .tvOS(.v14), .watchOS(.v7)
1010
],
1111
products: [
1212
// Products define the executables and libraries produced by a package, and make them visible to other packages.

‎README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ All issue reports, feature requests, contributions, and GitHub stars are welcome
5151
## Requirements
5252

5353
+ Xcode 12+
54-
+ iOS 13+ (14+ Recommended)
55-
+ macOS 10.15+ (11+ Recommended)
56-
+ tvOS 13+ (14+ Recommended)
57-
+ watchOS 6+ (7+ Recommended)
54+
+ iOS 14+
55+
+ macOS 11+
56+
+ tvOS 14+
57+
+ watchOS 7+
5858

5959
## SwiftUI 2.0 Compatibility
6060

@@ -74,9 +74,7 @@ var body: some View {
7474
}
7575
```
7676

77-
Note: However, many differences behavior between iOS 13/14's is hard to fixup. And we may break some APIs (which are not designed to be public) to fixup it.
78-
79-
Due to maintain issue, in the future release, we will drop the iOS 13 supports and always match SwiftUI 2.0's behavior. And **v2.x** may be the last version support iOS 13.
77+
Note: However, many differences behavior between iOS 13/14 is hard to fixup. Due to maintain issue, from SDWebImageSwiftUI v3.0, iOS 13 is no longer supported. We always match SwiftUI 2.0's behavior.
8078

8179

8280
## Installation
@@ -166,7 +164,14 @@ var body: some View {
166164
}
167165
```
168166

169-
Note: For indicator, you can custom your own as well. For example, iOS 14/watchOS 7 introduce the new `ProgressView`, which can replace our built-in `ProgressIndicator/ActivityIndicator` (where watchOS does not provide).
167+
Note: For indicator, you can custom your own as well. For example, iOS 14/watchOS 7 introduce the new `ProgressView`, which can be easily used via:
168+
169+
```swift
170+
WebImage(url: url)
171+
.indicator(.activity)
172+
```
173+
174+
or you can just write like:
170175

171176
```swift
172177
WebImage(url: url)
@@ -514,7 +519,7 @@ For caches, you actually don't need to worry about anything. It just works after
514519

515520
#### Using for backward deployment and weak linking SwiftUI
516521

517-
SDWebImageSwiftUI supports to use when your App Target has a deployment target version less than iOS 13/macOS 10.15/tvOS 13/watchOS 6. Which will weak linking of SwiftUI(Combine) to allows writing code with available check at runtime.
522+
SDWebImageSwiftUI supports to use when your App Target has a deployment target version less than iOS 14/macOS 11/tvOS 14/watchOS 7. Which will weak linking of SwiftUI(Combine) to allows writing code with available check at runtime.
518523

519524
To use backward deployment, you have to do the follow things:
520525

@@ -528,7 +533,7 @@ You should notice that all the third party SwiftUI frameworks should have this b
528533

529534
For deployment target version below iOS 12.2 (The first version which Swift 5 Runtime bundled in iOS system), you have to change the min deployment target version of SDWebImageSwiftUI. This may take some side effect on compiler's optimization and trigger massive warnings for some frameworks.
530535

531-
However, for iOS 12.2+, you can still keep the min deployment target version to iOS 13, no extra warnings or performance slow down for iOS 13 client.
536+
However, for iOS 12.2+, you can still keep the min deployment target version to iOS 14, no extra warnings or performance slow down for iOS 14 client.
532537

533538
Because Swift use the min deployment target version to detect whether to link the App bundled Swift runtime, or the System built-in one (`/usr/lib/swift/libswiftCore.dylib`).
534539

@@ -555,7 +560,7 @@ end
555560
+ For CocoaPods user, you can skip the platform version validation in Podfile with:
556561

557562
```ruby
558-
platform :ios, '13.0' # This does not effect your App Target's deployment target version, just a hint for CocoaPods
563+
platform :ios, '14.0' # This does not effect your App Target's deployment target version, just a hint for CocoaPods
559564
```
560565

561566
+ For SwiftPM user, SwiftPM does not support weak linking nor Library Evolution, so it can not deployment to iOS 12+ user without changing the min deployment target.
@@ -568,7 +573,7 @@ Add **all the SwiftUI code** with the available annotation and runtime check, li
568573
// AppDelegate.swift
569574
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
570575
// ...
571-
if #available(iOS 13, *) {
576+
if #available(iOS 14, *) {
572577
window.rootViewController = UIHostingController(rootView: ContentView())
573578
} else {
574579
window.rootViewController = ViewController()
@@ -590,11 +595,11 @@ class ViewController: UIViewController {
590595
}
591596

592597
// ContentView.swift
593-
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
598+
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
594599
struct ContentView : View {
595600
var body: some View {
596601
Group {
597-
Text("Hello World iOS 13!")
602+
Text("Hello World iOS 14!")
598603
WebImage(url: URL(string: "https://i.loli.net/2019/09/24/rX2RkVWeGKIuJvc.jpg"))
599604
}
600605
}
@@ -630,7 +635,7 @@ SDWebImageSwiftUI has Unit Test to increase code quality. For SwiftUI, there are
630635

631636
However, since SwiftUI is State-Based and Attributed-Implemented layout system, there are open source projects who provide the solution:
632637

633-
+ [ViewInspector](https://github.com/nalexn/ViewInspector): Inspect View's runtime attribute value (like `.frame` modifier, `.image` value). We use this to test `AnimatedImage` and `WebImage`. It also allows the inspect to native UIView/NSView, which we use to test `ActivityIndicator` and `ProgressIndicator`.
638+
+ [ViewInspector](https://github.com/nalexn/ViewInspector): Inspect View's runtime attribute value (like `.frame` modifier, `.image` value). We use this to test `AnimatedImage` and `WebImage`. It also allows the inspect to native UIView/NSView.
634639

635640
To run the test:
636641

‎SDWebImageSwiftUI.podspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ It brings all your favorite features from SDWebImage, like async image loading,
2121
s.author = { 'DreamPiggy' => 'lizhuoli1126@126.com' }
2222
s.source = { :git => 'https://github.com/SDWebImage/SDWebImageSwiftUI.git', :tag => s.version.to_s }
2323

24-
s.ios.deployment_target = '13.0'
25-
s.osx.deployment_target = '10.15'
26-
s.tvos.deployment_target = '13.0'
27-
s.watchos.deployment_target = '6.0'
24+
s.ios.deployment_target = '14.0'
25+
s.osx.deployment_target = '11.0'
26+
s.tvos.deployment_target = '14.0'
27+
s.watchos.deployment_target = '7.0'
2828

2929
s.source_files = 'SDWebImageSwiftUI/Classes/**/*', 'SDWebImageSwiftUI/Module/*.h'
3030
s.pod_target_xcconfig = {
@@ -34,5 +34,5 @@ It brings all your favorite features from SDWebImage, like async image loading,
3434

3535
s.weak_frameworks = 'SwiftUI', 'Combine'
3636
s.dependency 'SDWebImage', '~> 5.10'
37-
s.swift_version = '5.2'
37+
s.swift_version = '5.3'
3838
end

0 commit comments

Comments
 (0)
Please sign in to comment.