Skip to content

Commit 91286f2

Browse files
Skyline-23mattt
andauthored
Remove unused Combine import (#287)
* Remove Unused Combine Remove unused combine dependency * Replace CryptoKit to swift-crypto * Update commnet Co-authored-by: Mattt <mattt@me.com> * Revert commit to separate PR Replace CryptoKit * Update comment to pass Lint * Update comments for details Co-authored-by: Mattt <mattt@me.com> --------- Co-authored-by: Mattt <mattt@me.com>
1 parent 460358e commit 91286f2

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

Sources/Hub/Downloader.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
// See LICENSE at https://github.com/huggingface/swift-coreml-diffusers/LICENSE
77
//
88

9-
import Combine
109
import Foundation
1110

1211
/// A robust file downloader with support for resumable downloads and progress reporting.
1312
///
1413
/// The Downloader class handles file downloads from remote URLs with features including
1514
/// automatic resume capability, progress tracking, speed monitoring, and retry mechanisms.
1615
/// It supports both foreground and background download sessions for different use cases.
17-
final class Downloader: NSObject, Sendable, ObservableObject {
16+
final class Downloader: NSObject, Sendable {
1817
private let destination: URL
1918
private let incompleteDestination: URL
2019
private let downloadResumeState: DownloadResumeState = .init()

Sources/Hub/HubApi.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,10 @@ public extension HubApi {
491491
}
492492
}
493493

494-
/// Note we go from Combine in Downloader to callback-based progress reporting
495-
/// We'll probably need to support Combine as well to play well with Swift UI
496-
/// (See for example PipelineLoader in swift-coreml-diffusers)
494+
/// Downloads the file with progress tracking.
495+
/// - Parameter progressHandler: Called with download progress (0.0-1.0) and speed in bytes/sec, if available.
496+
/// - Returns: Local file URL (uses cached file if commit hash matches).
497+
/// - Throws: ``EnvironmentError`` errors for file and metadata validation failures, ``Downloader.DownloadError`` errors during transfer, or ``CancellationError`` if the task is cancelled.
497498
@discardableResult
498499
func download(progressHandler: @escaping (Double, Double?) -> Void) async throws -> URL {
499500
let localMetadata = try hub.readDownloadMetadata(metadataPath: metadataDestination)

Tests/HubTests/DownloaderTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// Created by Arda Atahan Ibis on 1/28/25.
66
//
77

8-
import Combine
98
import XCTest
109

1110
@testable import Hub

0 commit comments

Comments
 (0)