PSPDFApplication

@protocol PSPDFApplication <NSObject>

This class handles opening URLs for other applications and coordinates access to the network indicator manager since this is restricted in an iOS extension case.

  • Returns a Boolean value indicating whether or not the URL’s scheme can be handled by some app installed on the device.

    Declaration

    Objective-C

    - (BOOL)canOpenURL:(nonnull NSURL *)url;

    Swift

    func canOpen(_ url: URL) -> Bool

    Parameters

    url

    The URL to check.

    Return Value

    YES if the URL can be opened by an application on the system.

  • Asks the host to open an URL on the extension’s behalf if we are in an extension context. Else falls back to openURL: or openURL:options:completionHandler (iOS 10)

    Declaration

    Objective-C

    - (void)openURL:(nonnull NSURL *)url
                  options:(nullable NSDictionary<NSString *, id> *)options
        completionHandler:(nullable void (^)(BOOL))completionHandler;

    Swift

    func open(_ url: URL, options: [String : Any]? = nil, completionHandler: ((Bool) -> Void)? = nil)

    Parameters

    url

    The URL to open

    options

    Open options. Ignored unless running in iOS 10 (no extension)

    completionHandler

    Calls the completion handler. This might call the completion handler even though things did not work (iOS 8/9) because there’s no system concept, or because the handler gets called even if the alert is displayed and the app is not really launched yet. (iOS 10)

  • Coordinates access to the network indicator manager.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        id<PSPDFNetworkActivityIndicatorManager> _Nonnull networkIndicatorManager;

    Swift

    var networkIndicatorManager: PSPDFNetworkActivityIndicatorManager { get }