PSPDFCoordinatedFileDataProviding

Objective-C

@protocol PSPDFCoordinatedFileDataProviding <PSPDFFileDataProviding>

Swift

protocol CoordinatedFileDataProviding : FileDataProviding

File-based data providers that support file coordination (NSFileCoordinator).

  • The data provider’s file presenter. If the data provider implements NSFilePresenter itself, then return self. The data provider’s fileURL is expected to be the same as the file presenter’s presentedItemURL.

    Declaration

    Objective-C

    @property (nonatomic, readonly) id<NSFilePresenter> _Nonnull filePresenter;

    Swift

    var filePresenter: NSFilePresenter { get }
  • A data provider implementation may notify this delegate of NSFilePresenter-like notifications when the underlying file is updated. This property is set internally by PSPDFKit and should not be set otherwise.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<PSPDFFileCoordinationDelegate> _Nullable coordinationDelegate;

    Swift

    weak var coordinationDelegate: FileCoordinationDelegate? { get set }
  • Specifies whether conflict resolution is currently possible.

    Should be checked before invoking any conflict resolution calls on the data provider.

    The implementation of this property should reflect any internal limitations (like the file system type for the PSPDFCoordinatedFileDataProvider).

    Declaration

    Objective-C

    @optional
    @property (atomic, readonly) BOOL isConflictResolutionAvailable;

    Swift

    optional var isConflictResolutionAvailable: Bool { get }
  • Resolves a file conflict (externally removed or modified file) using a selected conflict resolution option.

    This method should be invoked in response to a presentedItemDidChangeForDataProvider: or accommodatePresentedItemDeletionForDataProvider:completionHandler: file presenter update.

    If the data provider is used in context of Document, invoking -[PSPDFDocument resolveFileConflictForDataProvider:withResolution:error:] should be preferred. It will call through to this implementation and also perform all necessary document updates.

    Note

    Passing PSPDFFileConflictResolutionSave does nothing if a file copy is not currently available (isConflictResolutionAvailable == NO).

    Declaration

    Objective-C

    - (BOOL)resolveFileConflictWithResolution:
                (PSPDFFileConflictResolution)resolution
                                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    optional func resolveFileConflict(with resolution: FileConflictResolution) throws

    Parameters

    resolution

    The conflict resolution option that should be performed.

    error

    Error details if the conflict resolution operation failed.

    Return Value

    true, if the conflict resolution was successful and false otherwise.