PSPDFSelectionState

@interface PSPDFSelectionState : NSObject<NSSecureCoding>

/// Returns an instance of the receiver configured to match the selectionView argument's state, if a selection exists.
+ (nullable instancetype)stateForSelectionView:(PSPDFTextSelectionView *)selectionView;

/// The uid of the document which the receiver corresponds to.
@property (nonatomic, readonly) NSString *UID;

/// The page index on which the selection exists.
@property (nonatomic, readonly) PSPDFPageIndex selectionPageIndex;

/**
 The range of glyphs (in `PSPDFTextParser.glyphs`) that are selected.
 If no glyphs are selected, this method returns `PSPDFInvalidGlyphRange`.
 */
@property (nonatomic, readonly) NSRange selectedGlyphRange;

/// The info for the selected image, if any.
@property (nonatomic, readonly, nullable) PSPDFImageInfo *selectedImage;

/**
 Returns a Boolean value that indicates whether a selection state is equal to the receiver.

 @param selectionState The selection with which to compare the receiver
 @return YES is `selectionState` is equivalent to the receiver, otherwise NO.
 */
- (BOOL)isEqualToSelectionState:(nullable PSPDFSelectionState *)selectionState;

@end

Undocumented

  • Returns an instance of the receiver configured to match the selectionView argument’s state, if a selection exists.

    Declaration

    Objective-C

    + (nullable instancetype)stateForSelectionView:
        (nonnull PSPDFTextSelectionView *)selectionView;

    Swift

    convenience init?(for selectionView: PSPDFTextSelectionView)
  • UID

    The uid of the document which the receiver corresponds to.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull UID;

    Swift

    var uid: String { get }
  • The page index on which the selection exists.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFPageIndex selectionPageIndex;

    Swift

    var selectionPageIndex: PageIndex { get }
  • The range of glyphs (in PSPDFTextParser.glyphs) that are selected. If no glyphs are selected, this method returns PSPDFInvalidGlyphRange.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSRange selectedGlyphRange;

    Swift

    var selectedGlyphRange: NSRange { get }
  • The info for the selected image, if any.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) PSPDFImageInfo *selectedImage;

    Swift

    var selectedImage: PSPDFImageInfo? { get }
  • Returns a Boolean value that indicates whether a selection state is equal to the receiver.

    Declaration

    Objective-C

    - (BOOL)isEqualToSelectionState:(nullable PSPDFSelectionState *)selectionState;

    Swift

    func isEqual(to selectionState: PSPDFSelectionState?) -> Bool

    Parameters

    selectionState

    The selection with which to compare the receiver

    Return Value

    YES is selectionState is equivalent to the receiver, otherwise NO.

  • Deprecated

    Deprecated in PSPDFKit 7.5 for iOS. This property has been deprecated in favour of the selectedGlyphRange field.

    The selected glyphs, if any.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSArray<PSPDFGlyph *> *selectedGlyphs;

    Swift

    var selectedGlyphs: [PSPDFGlyph]? { get }