PSPDFDownloadManager

Undocumented

  • The maximum number of concurrent downloads. Defaults to 2. If enableDynamicNumberOfConcurrentDownloads is enabled, this property will change dynamically and must be considered readonly.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSUInteger numberOfConcurrentDownloads;

    Swift

    var numberOfConcurrentDownloads: UInt { get set }
  • Enable this property to let PSPDFDownloadManager decide what the best number of concurrent downloads is depending on the network connection. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        BOOL enableDynamicNumberOfConcurrentDownloads;

    Swift

    var enableDynamicNumberOfConcurrentDownloads: Bool { get set }
  • The PSPDFDownloadManager delegate.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<PSPDFDownloadManagerDelegate> _Nullable delegate;

    Swift

    weak var delegate: PSPDFDownloadManagerDelegate? { get set }
  • Controls if objects that are currently loading when the app moves to the background should be completed in the background. Defaults to YES. iOS only.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        BOOL shouldFinishLoadingObjectsInBackground;

    Swift

    var shouldFinishLoadingObjectsInBackground: Bool { get set }
  • See enqueueObject:atFront:. Enqueues the object at the end of the queue.

    Declaration

    Objective-C

    - (void)enqueueObject:(nonnull id<PSPDFRemoteContentObject>)object;
  • Enqueues an PSPDFRemoteContentObject for download. If the object is already downloading, nothing is enqueued. If the object has been downloaded previously and has failed, it will be removed from the failedObjects array and re-enqueued. - parameter: object The object to enqueue. - parameter: enqueueAtFront Set this to YES to add the object to the front of the queue.

    Declaration

    Objective-C

    - (void)enqueueObject:(nonnull id<PSPDFRemoteContentObject>)object
                  atFront:(BOOL)enqueueAtFront;

    Parameters

    object

    The object to enqueue.

    enqueueAtFront

    Set this to YES to add the object to the front of the queue.

  • Calls enqueueObject:atFont: multiple times. Enqueues the object at the end of the queue. - parameter: objects need to implement the PSPDFRemoteContentObject protocol.

    Declaration

    Objective-C

    - (void)enqueueObjects:(nonnull NSArray<id<PSPDFRemoteContentObject>> *)objects;

    Parameters

    objects

    need to implement the PSPDFRemoteContentObject protocol.

  • Calls enqueueObject:atFont: multiple times. - parameter: objects need to implement the PSPDFRemoteContentObject protocol.

    Declaration

    Objective-C

    - (void)enqueueObjects:(nonnull NSArray<id<PSPDFRemoteContentObject>> *)objects
                   atFront:(BOOL)enqueueAtFront;

    Parameters

    objects

    need to implement the PSPDFRemoteContentObject protocol.

  • Cancels the download process for the given object. - parameter: object The object to be cancelled.

    Declaration

    Objective-C

    - (void)cancelObject:(nonnull id<PSPDFRemoteContentObject>)object;

    Parameters

    object

    The object to be cancelled.

  • Calls cancelObject: for all objects in pendingObjects, loadingObjects, and failedObjects.

    Declaration

    Objective-C

    - (void)cancelAllObjects;

    Swift

    func cancelAllObjects()
  • The current reachability of the device.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFReachability reachability;

    Swift

    var reachability: PSPDFReachability { get }
  • Contains all objects waiting to be downloaded.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSArray<id<PSPDFRemoteContentObject>> *_Nonnull waitingObjects;
  • Contains all currently loading objects.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSArray<id<PSPDFRemoteContentObject>> *_Nonnull loadingObjects;
  • Contains all objects that have failed because of a network error and are scheduled for retry.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSArray<id<PSPDFRemoteContentObject>> *_Nonnull failedObjects;
  • Helper that iterates loadingObjects, waitingObjects and failedObjects (in that order) and returns all matches.

    Declaration

    Objective-C

    - (nonnull NSArray<id<PSPDFRemoteContentObject>> *)objectsPassingTest:
        (nonnull BOOL (^)(id<PSPDFRemoteContentObject> _Nonnull, NSUInteger,
                          BOOL *_Nonnull))predicate;
  • Checks if the given object is currently handled by the download manager. - parameter: object The object. - returns: YES if the download manager handles the object, that is if it is either pending, loading or failed.

    Declaration

    Objective-C

    - (BOOL)handlesObject:(nonnull id<PSPDFRemoteContentObject>)object;

    Parameters

    object

    The object.

    Return Value

    YES if the download manager handles the object, that is if it is either pending, loading or failed.

  • Checks and returns the current state of a given object. If the object has never been enqueued, PSPDFDownloadManagerObjectStateNotHandled will be returned. - parameter: object The object. - returns: The state of the object.

    Declaration

    Objective-C

    - (PSPDFDownloadManagerObjectState)stateForObject:
        (nonnull id<PSPDFRemoteContentObject>)object;

    Parameters

    object

    The object.

    Return Value

    The state of the object.