PSPDFUsernameHelper


@interface PSPDFUsernameHelper : NSObject

A helper that can be used to present a dialog, allowing the user to specify the annotation author name.

  • Access or set the default username. The default will be inferred based on the device name and some internal logic.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, null_resettable, class)
        NSString *defaultAnnotationUsername;

    Swift

    class var defaultAnnotationUsername: String! { get set }
  • Declaration

    Objective-C

    @property (readonly, nonatomic, class) BOOL isDefaultAnnotationUserNameSet;

    Swift

    class var isDefaultAnnotationUserNameSet: Bool { get }
  • Asks for the default new annotation username, if enabled in the controller configuration if not already set. The completion block gets always called, unless the dialog is shown and called. Use this call if you’re presenting a custom annotation creation UI (e.g., a custom toolbar). Present your UI / toolbar inside the completion block.

    Declaration

    Objective-C

    + (void)askForDefaultAnnotationUsernameIfNeeded:
                (nonnull PSPDFViewController *)pdfViewController
                                    completionBlock:
                                        (nonnull void (^)(NSString *_Nonnull))
                                            completionBlock;

    Swift

    class func ask(forDefaultAnnotationUsernameIfNeeded pdfViewController: PSPDFViewController, completionBlock: @escaping (String) -> Void)
  • Asks for a new default username on the provided view controller. - parameter: suggestedName A username to be pre-filled in the dialog. If nil we’ll try to guess the username. - parameter: completionBlock Only called if successful.

    Declaration

    Objective-C

    - (void)
    askForDefaultAnnotationUsername:(nonnull UIViewController *)viewController
                      suggestedName:(nullable NSString *)suggestedName
                    completionBlock:
                        (nonnull void (^)(NSString *_Nonnull))completionBlock;

    Swift

    func ask(forDefaultAnnotationUsername viewController: UIViewController, suggestedName: String?, completionBlock: @escaping (String) -> Void)

    Parameters

    suggestedName

    A username to be pre-filled in the dialog. If nil we’ll try to guess the username.

    completionBlock

    Only called if successful.