PSPDFRemoteContentObject

Objective-C

@protocol PSPDFRemoteContentObject <NSObject>

Swift

protocol RemoteContentObject : NSObjectProtocol

Contains information about remote content.

  • The URL request used for loading the remote content.

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

    @property (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 (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isLoadingRemoteContent) 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 (nonatomic, assign, unsafe_unretained, readwrite)
        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 (nonatomic, assign, unsafe_unretained, readwrite, 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 (nonatomic, readonly) 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 (nonatomic, readonly)
        BOOL shouldRetryLoadingRemoteContentOnConnectionFailure;

    Swift

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

    Declaration

    Objective-C

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

    Swift

    optional var remoteContentAuthenticationChallengeBlock: PSPDFRemoteContentObjectAuthenticationBlock { get }
  • Return a custom PSPDFRemoteContentObjectTransformerBlock. The passed-in URL 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 Data) of the downloaded content.

    Note

    If shouldCacheRemoteContent returns true 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 (nonatomic, readonly, nullable)
        PSPDFRemoteContentObjectTransformerBlock remoteContentTransformerBlock;

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

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