PSPDFRemoteContentObject

@protocol PSPDFRemoteContentObject<NSObject>

/// The URL request used for loading the remote content.
@property (nonatomic, readonly, nullable) NSURLRequest *URLRequestForRemoteContent;

/// The remote content of the object. This property is managed by `PSPDFDownloadManager`.
@property (nonatomic, nullable) id remoteContent;

@optional

/// The loading state of the object. This property is managed by `PSPDFDownloadManager`.
@property (nonatomic, getter=isLoadingRemoteContent) BOOL loadingRemoteContent;

/// The download progress of the object. Only meaningful if `loadingRemoteContent` is YES.
/// This property is managed by `PSPDFDownloadManager`.
@property (nonatomic) CGFloat remoteContentProgress;

/// The remote content error of the object. This property is managed by `PSPDFDownloadManager`.
@property (nonatomic, nullable) NSError *remoteContentError;

/// Return YES if you want `PSPDFDownloadManager` to cache the remote content. Defaults to NO.
@property (nonatomic, readonly) BOOL shouldCacheRemoteContent;

/// Return YES if you want `PSPDFDownloadManager` to retry downloading remote content if a connection
/// error occurred. Defaults to NO.
@property (nonatomic, readonly) BOOL shouldRetryLoadingRemoteContentOnConnectionFailure;

/// Return a block if you need to handle a authentication challenge.
@property (nonatomic, readonly) PSPDFRemoteContentObjectAuthenticationBlock remoteContentAuthenticationChallengeBlock;

/// Return a custom `PSPDFRemoteContentObjectTransformerBlock`. The passed-in `NSURL` points to the
/// file that stores the downloaded data. The return value is set to `remoteContent`. If no transformer
/// block is provided, `remoteContent` will be set to data (represented by `NSData`) of the downloaded
/// content.
///
/// @note If `shouldCacheRemoteContent` returns `YES` the location of the file is not temporary.
/// @note `remoteContentTransformerBlock` will be called on a background queue, so you may perform
/// long-running tasks.
/// @warning Since this runs on a background queue, you should not access state outside of the block's
/// scope to avoid thread-safety problems.
@property (nonatomic, readonly, nullable) PSPDFRemoteContentObjectTransformerBlock remoteContentTransformerBlock;

/// Return `YES` if the object actually has remote content. Since most `PSPDFRemoteContentObject`s
/// will have remote content, this method is optional. If it is not implemented, `YES` will be assumed.
@property (nonatomic, readonly) BOOL hasRemoteContent;

/// The completion block, called after loading finished.
@property (nonatomic, copy, nullable) void (^completionBlock)(id<PSPDFRemoteContentObject> remoteObject);

@end

Undocumented

  • The URL request used for loading the remote content.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable)
        NSURLRequest *URLRequestForRemoteContent;

    Swift

    var urlRequestForRemoteContent: URLRequest? { get }
  • The remote content of the object. This property is managed by PSPDFDownloadManager.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable) id remoteContent;

    Swift

    var remoteContent: Any? { get set }
  • The loading state of the object. This property is managed by PSPDFDownloadManager.

    Declaration

    Objective-C

    @optional
    @property (getter=isLoadingRemoteContent, assign, readwrite, nonatomic)
        BOOL loadingRemoteContent;

    Swift

    optional var isLoadingRemoteContent: Bool { get set }
  • The download progress of the object. Only meaningful if loadingRemoteContent is YES. This property is managed by PSPDFDownloadManager.

    Declaration

    Objective-C

    @optional
    @property (assign, readwrite, nonatomic) CGFloat remoteContentProgress;

    Swift

    optional var remoteContentProgress: CGFloat { get set }
  • The remote content error of the object. This property is managed by PSPDFDownloadManager.

    Declaration

    Objective-C

    @optional
    @property (assign, readwrite, nonatomic, nullable) NSError *remoteContentError;

    Swift

    optional var remoteContentError: Error? { get set }
  • Return YES if you want PSPDFDownloadManager to cache the remote content. Defaults to NO.

    Declaration

    Objective-C

    @optional
    @property (readonly, nonatomic) BOOL shouldCacheRemoteContent;

    Swift

    optional var shouldCacheRemoteContent: Bool { get }
  • Return YES if you want PSPDFDownloadManager to retry downloading remote content if a connection error occurred. Defaults to NO.

    Declaration

    Objective-C

    @optional
    @property (readonly, nonatomic)
        BOOL shouldRetryLoadingRemoteContentOnConnectionFailure;

    Swift

    optional var shouldRetryLoadingRemoteContentOnConnectionFailure: Bool { get }
  • Return a block if you need to handle a authentication challenge.

    Declaration

    Objective-C

    @optional
    @property (readonly, nonatomic)
        PSPDFRemoteContentObjectAuthenticationBlock _Nonnull remoteContentAuthenticationChallengeBlock;

    Swift

    optional var remoteContentAuthenticationChallengeBlock: PSPDFRemoteContentObjectAuthenticationBlock { get }
  • Return a custom PSPDFRemoteContentObjectTransformerBlock. The passed-in NSURL points to the file that stores the downloaded data. The return value is set to remoteContent. If no transformer block is provided, remoteContent will be set to data (represented by NSData) of the downloaded content.

    Note

    If shouldCacheRemoteContent returns YES the location of the file is not temporary.

    Note

    remoteContentTransformerBlock will be called on a background queue, so you may perform long-running tasks.

    Warning

    Since this runs on a background queue, you should not access state outside of the block’s scope to avoid thread-safety problems.

    Declaration

    Objective-C

    @optional
    @property (readonly, nonatomic, nullable)
        PSPDFRemoteContentObjectTransformerBlock remoteContentTransformerBlock;

    Swift

    optional var remoteContentTransformerBlock: PSPDFRemoteContentObjectTransformerBlock? { get }
  • Return YES if the object actually has remote content. Since most PSPDFRemoteContentObjects will have remote content, this method is optional. If it is not implemented, YES will be assumed.

    Declaration

    Objective-C

    @optional
    @property (readonly, nonatomic) BOOL hasRemoteContent;

    Swift

    optional var hasRemoteContent: Bool { get }
  • The completion block, called after loading finished.

    Declaration

    Objective-C

    @optional
    @property (readwrite, copy, nonatomic, nullable) void (^)
        (id<PSPDFRemoteContentObject> _Nonnull) completionBlock;

    Swift

    optional var completionBlock: ((PSPDFRemoteContentObject) -> Void)? { get set }