@@ -15,6 +15,8 @@ import FoundationNetworking
15
15
#endif
16
16
17
17
/// Error enumeration that can be returned by a `Downloader` conforming type.
18
+ // deprecated 2/2021
19
+ @available ( * , deprecated, message: " moved to SwiftPM, use URLSession or async-http-client instead " )
18
20
public enum DownloaderError : Error {
19
21
20
22
/// Error thrown when the downloader fails to establish a connection to the server.
@@ -28,6 +30,8 @@ public enum DownloaderError: Error {
28
30
}
29
31
30
32
/// The `Downloader` protocol abstract away the download of a file with a progress report.
33
+ // deprecated 2/2021
34
+ @available ( * , deprecated, message: " moved to SwiftPM, use URLSession or async-http-client instead " )
31
35
public protocol Downloader {
32
36
33
37
/// The progress closure type. The first arguments contains the number of bytes downloaded, and the second argument
@@ -55,6 +59,8 @@ public protocol Downloader {
55
59
)
56
60
}
57
61
62
+ // deprecated 2/2021
63
+ @available ( * , deprecated, message: " moved to SwiftPM, use URLSession or async-http-client instead " )
58
64
extension DownloaderError : LocalizedError {
59
65
public var errorDescription : String ? {
60
66
switch self {
@@ -69,6 +75,8 @@ extension DownloaderError: LocalizedError {
69
75
}
70
76
71
77
/// A `Downloader` conformance that uses Foundation's `URLSession`.
78
+ // deprecated 2/2021
79
+ @available ( * , deprecated, message: " moved to SwiftPM, use URLSession or async-http-client instead " )
72
80
public final class FoundationDownloader : NSObject , Downloader {
73
81
74
82
/// The integer identifier of a `URLSessionTask`.
@@ -134,6 +142,8 @@ public final class FoundationDownloader: NSObject, Downloader {
134
142
}
135
143
}
136
144
145
+ // deprecated 2/2021
146
+ @available ( * , deprecated, message: " moved to SwiftPM, use URLSession or async-http-client instead " )
137
147
extension FoundationDownloader : URLSessionDownloadDelegate {
138
148
public func urlSession(
139
149
_ session: URLSession ,
@@ -177,6 +187,8 @@ extension FoundationDownloader: URLSessionDownloadDelegate {
177
187
}
178
188
}
179
189
190
+ // deprecated 2/2021
191
+ @available ( * , deprecated, message: " moved to SwiftPM, use URLSession or async-http-client instead " )
180
192
extension FoundationDownloader {
181
193
182
194
/// Returns the download data structure associated with a task and fails if none is found as this should never
@@ -191,6 +203,8 @@ extension FoundationDownloader {
191
203
}
192
204
}
193
205
206
+ // deprecated 2/2021
207
+ @available ( * , deprecated, message: " moved to SwiftPM, use URLSession or async-http-client instead " )
194
208
extension FoundationDownloader . Download {
195
209
func notifyProgress( bytesDownloaded: Int64 , totalBytesToDownload: Int64 ? ) {
196
210
DispatchQueue . global ( ) . async {
0 commit comments