PSPDFFileCoordinationDelegate
Objective-C
@protocol PSPDFFileCoordinationDelegate <NSObject>
Swift
protocol FileCoordinationDelegate : NSObjectProtocol
Methods that need to be implemented by the coordinationDelegate
of a coordinated file data
provider. As such, all methods in this protocol are required.
-
Called after the underlying file was modified.
Roughly corresponds to a
presentedItemDidChange
NSFilePresenter
notification. This call is only invoked if the file content changes since the last successful read. File metadata updates are ignored. Will be called on a private queue.Declaration
Objective-C
- (void)presentedItemDidChangeForDataProvider: (nonnull id<PSPDFCoordinatedFileDataProviding>)dataProvider;
Swift
func presentedItemDidChange(forDataProvider dataProvider: CoordinatedFileDataProviding)
Parameters
dataProvider
The requesting coordinated file data provider.
-
Called when the underlying file is about to be deleted.
Corresponds to a
accommodatePresentedItemDeletionWithCompletionHandler:
NSFilePresenter
notification. Will be called on a private queue.Note
It is crucial that completionHandler is invoked after this method is handled. Best to do it on the same queue and not dispatching. Dispatchign to the main thread and invoking the callback can lead to deadlocks if the file is deleted from the main thread in the host app.
Declaration
Objective-C
- (void)accommodatePresentedItemDeletionForDataProvider: (nonnull id<PSPDFCoordinatedFileDataProviding>)dataProvider completionHandler: (nonnull void (^)(NSError *_Nullable)) completionHandler;
Swift
func accommodatePresentedItemDeletion(forDataProvider dataProvider: CoordinatedFileDataProviding, completionHandler: @escaping (Error?) -> Void)
Parameters
dataProvider
The requesting coordinated file data provider.
completionHandler
Should be invoked to allow the deletion to continue.