DownloadService
public class DownloadService : NSObject
Main service
-
Shared instance. Just use it!
Declaration
Swift
public static let shared: DownloadService
-
Позволяет узнать, есть ли у нас активные загрузки. Загрузки, которые стоят в ожидании (ждут завершения других или по другим причинам), также считаются активными
Declaration
Swift
public var hasActiveDownloads: Bool { get }
-
Объект конфигурации
Declaration
Swift
public var configuration: DownloadManagerConfig { get set }
-
Register callback which is called when download service initialized and ready to work.
Declaration
Swift
public func onReady(_ callback: @escaping () -> Void)
Parameters
callback
callback
-
Registers
Downloadable
`s type in manager for service could use fabric initializers for creating instancesDeclaration
Swift
public func register<T>(_ downloadableType: T.Type) where T : Downloadable
Parameters
downloadableType
type
-
Must be used in UIApplicationDelegate to catch downloads finish
Declaration
Swift
public var backgroundSessionCompletionHandlerBlock: () -> () { get set }
-
Called when more downloads are active
Declaration
Swift
public var incrementNetworkActivityCountHandler: () -> Void
-
Called when some of downloads is finished
Declaration
Swift
public var decrementNetworkActivityCountHandler: () -> Void