DMSwift
public class DMSwift
DMSwift provides a simple and efficient way to download files. It can simultaneously download a large number of files, monitors the progress of downloading, concurrently post-process downloaded files, supports logging, has a flexible configuration and easy to use API.
-
Download progress delegate.
There is no reason to declare delegate as weak, as only Value Types are passed. also due to weak, delegates do not work when the
Downloaderclass is declared locally.Declaration
Swift
public weak var downloadProgressDelegate: DownloaderProgressDelegate? -
Post-process delegate
There is no reason to declare delegate as weak, as only Value Types are passed. also due to weak, delegates do not work when the
Downloaderclass is declared locally.Declaration
Swift
public weak var postProcessDelegate: PostProcessDelegate? -
Informs when downloaded size or total files size changes.
Declaration
Swift
public var onDownloadUpdateSize: ((_ progress: DMSwiftTypealias.DownloadedSizeProgress) -> Void)? -
Informs on changes in download task count progress.
Declaration
Swift
public var onDownloadUpdateTaskCount: ((_ progress: DMSwiftTypealias.TaskCountProgress) -> Void)? -
Informs when download operations started.
Declaration
Swift
public var onDownloadStarted: (() -> Void)? -
Informs when all download operations finished.
Declaration
Swift
public var onDownloadComplete: (() -> Void)? -
Informs when downloaded operations finished and some of them have errors.
Declaration
Swift
public var onDownloadCompletedWithError: ((_ tasks: [DMSwiftTypealias.Download.FailedTask]) -> Void)? -
Informs when post-processing operations started.
Declaration
Swift
public var onPostProcessStarted: (() -> Void)? -
Informs when all post-processing operations finished.
Declaration
Swift
public var onPostProcessCompleted: (() -> Void)? -
Informs when post-processing operations finished and some of them have errors.
Declaration
Swift
public var onProcessCompletedWithError: ((_ tasks: [DMSwiftTypealias.PostProcess.FailedTask]) -> Void)? -
Informs on changes in post-process operations count progress.
Declaration
Swift
public var onPostProcessUpdateTaskCount: ((_ progress: DMSwiftTypealias.TaskCountProgress) -> Void)? -
Customizable configuration.
Declaration
Swift
public var configuration: DMSwiftConfiguration { get set } -
File storage manager.
Declaration
Swift
public var fileStorage: FileStorage { get set } -
Download queue.
Declaration
Swift
var downloadQueue: DownloadQueue -
Post-process queue.
Declaration
Swift
var postProcessQueue: PostProcessQueue -
Logging level.
Declaration
Swift
var logLevel: LogLevel { get set } -
Initiates with default configuration.
Declaration
Swift
public init() -
Initiates with required parameters.
Declaration
Swift
public init(path: String? = nil, postProcessings: [PostProcessing] = [], configuration: DMSwiftConfiguration = DefaultDMSwiftConfiguration(), fileStorageConfiguration: FileStorageConfiguration = DefaultFileStorageConfiguration(), logLevel: LogLevel = .none)Parameters
pathSpecifies the path where files will be saved.
postProcessingsList of post-processes for downloaded files.
configurationConfiguration.
fileStorageConfigurationConfiguration that used for
FileStorageManager.logLevelLogging level.
-
Initiates with required parameters.
Declaration
Swift
public convenience init(path: String?)Parameters
pathSpecifies the path where files will be saved.
-
Prepares files for download, removes duplicates from the provided list of requests.
if the file is present locally,
forceDownload == trueor the request is already in the download queue, then it will not be added to download queue.Declaration
Swift
func prepareDownload(_ requests: [URLRequestTestable], forceDownload: Bool = false, completion: ((_ fileData: DMSwiftTypealias.Download.FileData) -> Void)? = nil)Parameters
requestsRequests for remote files.
forceDownloadWhether to force download, even if the file with the same name located in the device storage.
completionCompletion handler called when one of the download operations is finish in the queue.
DMSwift Class Reference