Skip to content

Instantly share code, notes, and snippets.

@rustle
Created January 31, 2013 00:28
Show Gist options
  • Save rustle/4678755 to your computer and use it in GitHub Desktop.
Save rustle/4678755 to your computer and use it in GitHub Desktop.
Couple of typedefs that I think make the NSFilePresenter block APIs a little easier to read
typedef void (^FilePresenterReacquirerBlock)(void);
typedef void (^FilePresenterReaderBlock)(FilePresenterReacquirerBlock reacquirer);
typedef void (^FilePresenterWriterBlock)(FilePresenterReacquirerBlock reacquirer);
typedef void (^FilePresenterCompletionHandler)(NSError *errorOrNil);
- (void)relinquishPresentedItemToReader:(FilePresenterReaderBlock)reader
{
// Do stuff here ahead of reading
reader(^{
// Do stuff here after reading is done
});
}
- (void)relinquishPresentedItemToWriter:(FilePresenterWriterBlock)writer
{
// Do stuff here ahead of writing
writer(^{
// Do stuff here for after writing is done
});
}
- (void)savePresentedItemChangesWithCompletionHandler:(FilePresenterCompletionHandler)completionHandler
{
completionHandler(nil);
}
- (void)accommodatePresentedItemDeletionWithCompletionHandler:(FilePresenterCompletionHandler)completionHandler
{
completionHandler(nil);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment