2 // MZDownloadModel.swift
5 // Created by Muhammad Zeeshan on 19/04/2016.
6 // Copyright © 2016 ideamakerz. All rights reserved.
11 public enum TaskStatus: Int {
12 case unknown, gettingInfo, downloading, paused, failed
14 public func description() -> String {
30 open class MZDownloadModel: NSObject {
32 open var fileName: String!
33 open var fileURL: String!
34 open var status: String = TaskStatus.gettingInfo.description()
36 open var file: (size: Float, unit: String)?
37 open var downloadedFile: (size: Float, unit: String)?
39 open var remainingTime: (hours: Int, minutes: Int, seconds: Int)?
41 open var speed: (speed: Float, unit: String)?
43 open var progress: Float = 0
45 open var task: URLSessionDownloadTask?
47 open var startTime: Date?
49 fileprivate(set) open var destinationPath: String = ""
51 fileprivate convenience init(fileName: String, fileURL: String) {
54 self.fileName = fileName
55 self.fileURL = fileURL
58 convenience init(fileName: String, fileURL: String, destinationPath: String) {
59 self.init(fileName: fileName, fileURL: fileURL)
61 self.destinationPath = destinationPath