PSPDFDocumentFeaturesObserver

Objective-C

@protocol PSPDFDocumentFeaturesObserver <NSObject>

Swift

protocol PDFDocumentFeaturesObserver : NSObjectProtocol

An observer will be returned to you when you start observing a feature for state changes. You can either keep the observer around for removing it later on or you can bind it to the lifetime of another class which will then remove the observer automatically when the other object gets deallocated.

  • Instead of retaining the observer yourself to be able to later on remove the observer again you can also bind it to the lifetime of another object so that the observer is automatically removed when this object gets deallocated.

    Note

    This is not guaranteed to be thread safe: if the object is being deallocated while observers are being called, the call registered with this observer might get called again but the observer will be removed at some point.

    Declaration

    Objective-C

    - (void)bindToObjectLifetime:(nonnull id)object;

    Swift

    func bind(toObjectLifetime object: Any)

    Parameters

    object

    The object to bind the observer’s lifetime to.