PSPDFDownloadManager
Objective-C
@interface PSPDFDownloadManager : NSObject
Swift
class DownloadManager : NSObject
This class handles remote content downloading.
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
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 (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 (nonatomic) BOOL enableDynamicNumberOfConcurrentDownloads;
Swift
var enableDynamicNumberOfConcurrentDownloads: Bool { get set }
-
The
PSPDFDownloadManager
delegate.Declaration
Objective-C
@property (nonatomic, weak) id<PSPDFDownloadManagerDelegate> _Nullable delegate;
Swift
weak var delegate: DownloadManagerDelegate? { 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 (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;
Swift
func enqueue(_ object: RemoteContentObject)
-
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.Declaration
Objective-C
- (void)enqueueObject:(nonnull id<PSPDFRemoteContentObject>)object atFront:(BOOL)enqueueAtFront;
Swift
func enqueue(_ object: RemoteContentObject, atFront enqueueAtFront: Bool)
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.
Declaration
Objective-C
- (void)enqueueObjects:(nonnull NSArray<id<PSPDFRemoteContentObject>> *)objects;
Swift
func enqueue(_ objects: [RemoteContentObject])
Parameters
objects
need to implement the
PSPDFRemoteContentObject
protocol. -
Calls enqueueObject:atFont: multiple times.
Declaration
Objective-C
- (void)enqueueObjects:(nonnull NSArray<id<PSPDFRemoteContentObject>> *)objects atFront:(BOOL)enqueueAtFront;
Swift
func enqueue(_ objects: [RemoteContentObject], atFront enqueueAtFront: Bool)
Parameters
objects
need to implement the
PSPDFRemoteContentObject
protocol. -
Cancels the download process for the given object.
Declaration
Objective-C
- (void)cancelObject:(nonnull id<PSPDFRemoteContentObject>)object;
Swift
func cancel(_ object: RemoteContentObject)
Parameters
object
The object to be cancelled.
-
Calls
cancelObject:
for all objects inpendingObjects
,loadingObjects
, andfailedObjects
. -
The current reachability of the device.
Declaration
Objective-C
@property (nonatomic, readonly) PSPDFReachability reachability;
Swift
var reachability: ReachabilityStatus { get }
-
Contains all objects waiting to be downloaded.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSArray<id<PSPDFRemoteContentObject>> *_Nonnull waitingObjects;
Swift
var waitingObjects: [RemoteContentObject] { get }
-
Contains all currently loading objects.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSArray<id<PSPDFRemoteContentObject>> *_Nonnull loadingObjects;
Swift
var loadingObjects: [RemoteContentObject] { get }
-
Contains all objects that have failed because of a network error and are scheduled for retry.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSArray<id<PSPDFRemoteContentObject>> *_Nonnull failedObjects;
Swift
var failedObjects: [RemoteContentObject] { get }
-
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;
Swift
func objects(passingTest predicate: @escaping (RemoteContentObject, UInt, UnsafeMutablePointer<ObjCBool>) -> Bool) -> [RemoteContentObject]
-
Checks if the given object is currently handled by the download manager.
Declaration
Objective-C
- (BOOL)handlesObject:(nonnull id<PSPDFRemoteContentObject>)object;
Swift
func handlesObject(_ object: RemoteContentObject) -> Bool
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.Declaration
Objective-C
- (PSPDFDownloadManagerObjectState)stateForObject: (nonnull id<PSPDFRemoteContentObject>)object;
Swift
func state(for object: RemoteContentObject) -> DownloadManager.ObjectState
Parameters
object
The object.
Return Value
The state of the object.