PSPDFDocumentActionExecutor


@interface PSPDFDocumentActionExecutor
    : NSObject <PSPDFDocumentSharingCoordinatorDelegate>

Helper class that can invoke common actions on the document.

  • Initialize with the controller we should present on. Requires the controller to implement the <PSPDFPresentationActions> protocol to have additional control over presentation options.

    Warning

    Will return nil if sourceViewController is nil.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithSourceViewController:
        (nonnull UIViewController<PSPDFPresentationActions> *)sourceViewController;

    Swift

    init(sourceViewController: Any!)
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFDocumentActionExecutor
        : NSObject <PSPDFDocumentSharingCoordinatorDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFDocumentActionExecutor
        : NSObject <PSPDFDocumentSharingCoordinatorDelegate>
  • The view controller from which the document action interface should be presented. Weakly held. If this is nil, actions will no longer work.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        UIViewController<PSPDFPresentationActions> *_Nullable sourceViewController;
  • Delegate to forward errors and also fetch the currently visible pages.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<PSPDFDocumentActionExecutorDelegate> _Nullable delegate;

    Swift

    weak var delegate: PSPDFDocumentActionExecutorDelegate? { get set }
  • The attached documents this class operates on.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable)
        NSArray<PSPDFDocument *> *documents;

    Swift

    var documents: [PSPDFDocument]? { get set }
  • Checks if action can be called.

    Returns NO on unknown actions, asserts if action string is nil.

    Note

    If the document is not set, no action will be executable.

    Declaration

    Objective-C

    - (BOOL)canExecuteAction:(nonnull NSString *)action;

    Swift

    func canExecuteAction(_ action: String) -> Bool
  • Executes action with options (optional). sender is optional as well. Asserts if action is nil; will NOP if action is unknown. options can contain PSPDFDocumentActionVisiblePagesKey and PSPDFDocumentActionSharingOptionsKey. Also accepts presentation option keys.

    Declaration

    Objective-C

    - (void)executeAction:(nonnull NSString *)action
                  options:(nullable NSDictionary<NSString *, id> *)options
                   sender:(nullable id)sender
                 animated:(BOOL)animated
               completion:(nullable void (^)(void))completion;

    Swift

    func executeAction(_ action: String, options: [String : Any]? = nil, sender: Any?, animated: Bool, completion: (() -> Void)? = nil)