Skip to content

Commit 7fa3875

Browse files
authored
Merge pull request #192 from tomerd/deprecate-downloader
mark Downloader as deprecated
2 parents 5b0bfcb + cf54080 commit 7fa3875

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Sources/TSCUtility/Downloader.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import FoundationNetworking
1515
#endif
1616

1717
/// 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")
1820
public enum DownloaderError: Error {
1921

2022
/// Error thrown when the downloader fails to establish a connection to the server.
@@ -28,6 +30,8 @@ public enum DownloaderError: Error {
2830
}
2931

3032
/// 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")
3135
public protocol Downloader {
3236

3337
/// The progress closure type. The first arguments contains the number of bytes downloaded, and the second argument
@@ -55,6 +59,8 @@ public protocol Downloader {
5559
)
5660
}
5761

62+
// deprecated 2/2021
63+
@available(*, deprecated, message: "moved to SwiftPM, use URLSession or async-http-client instead")
5864
extension DownloaderError: LocalizedError {
5965
public var errorDescription: String? {
6066
switch self {
@@ -69,6 +75,8 @@ extension DownloaderError: LocalizedError {
6975
}
7076

7177
/// 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")
7280
public final class FoundationDownloader: NSObject, Downloader {
7381

7482
/// The integer identifier of a `URLSessionTask`.
@@ -134,6 +142,8 @@ public final class FoundationDownloader: NSObject, Downloader {
134142
}
135143
}
136144

145+
// deprecated 2/2021
146+
@available(*, deprecated, message: "moved to SwiftPM, use URLSession or async-http-client instead")
137147
extension FoundationDownloader: URLSessionDownloadDelegate {
138148
public func urlSession(
139149
_ session: URLSession,
@@ -177,6 +187,8 @@ extension FoundationDownloader: URLSessionDownloadDelegate {
177187
}
178188
}
179189

190+
// deprecated 2/2021
191+
@available(*, deprecated, message: "moved to SwiftPM, use URLSession or async-http-client instead")
180192
extension FoundationDownloader {
181193

182194
/// 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 {
191203
}
192204
}
193205

206+
// deprecated 2/2021
207+
@available(*, deprecated, message: "moved to SwiftPM, use URLSession or async-http-client instead")
194208
extension FoundationDownloader.Download {
195209
func notifyProgress(bytesDownloaded: Int64, totalBytesToDownload: Int64?) {
196210
DispatchQueue.global().async {

Tests/TSCUtilityTests/DownloaderTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import Foundation
1717
import FoundationNetworking
1818
#endif
1919

20+
// deprecated 2/2021
21+
@available(*, deprecated)
2022
class DownloaderTests: XCTestCase {
2123

2224
func testSuccess() throws {

0 commit comments

Comments
 (0)