PSPDFInstantViewController
Objective-C
@interface PSPDFInstantViewController : PSPDFViewController
Swift
class InstantViewController : PDFViewController
A specialized variant of PDFViewController
that supports annotation synchronization.
Showing a document managed by Instant in any other view controller is not supported.
Instant on iOS doesn’t support these annotation types: caret, file, redaction, and sound. It also doesn’t support
PDF forms. As such, this class sanitizes its PDFConfiguration
to only allow supported annotation types.
This view controller doesn’t support sharing documents.
The activityButtonItem
will automatically not be shown.
If you choose to set the builder’s editableAnnotationTypes
to nil
, all supported annotation
types will be editable. If you set editableAnnotationTypes
to an empty set, no annotations will
be editable.
-
Whether the view controller should listen for server changes when visible.
When
true
, the view controller will take care of subscribing to and unsubscribing from live changes from the server when it is moved on or off screen. Note that setting this value tofalse
does not mean that you will not receive any changes from the server:
Whenever aPSPDFInstantDocumentDescriptor
is being synced, all of the related documents are updated automatically. So if, for example, you display a secondaryPSPDFInstantViewController
on an external display, while you are editing in a primaryPSPDFInstantViewController
, that secondary view controller will be updated even if it hasshouldListenForServerChangesWhenVisible
set tofalse
.The default value of this property is
true
.Declaration
Objective-C
@property (nonatomic) BOOL shouldListenForServerChangesWhenVisible;
Swift
var shouldListenForServerChangesWhenVisible: Bool { get set }
-
Triggers a one-shot sync action.
When the document isn’t Instant enabled, or already syncing, this method does nothing. Otherwise, it triggers a one- time sync action. This is useful when you don’t want automatic syncing to reduce the energy footprint of your app.
Declaration
Objective-C
- (void)syncChanges:(nullable id)sender;
Swift
@IBAction func syncChanges(_ sender: Any?)
-
Whether the view controller should automatically handle certain critical errors.
If
true
, when this view controller’s view is visible and aPSPDFInstantErrorIncompatibleVersion
error occurs for the current document, automatic syncing will be disabled and an alert will be shown that tells the user the app must be updated.Defaults to
true
.We recommended that you make your app appropriately handle all errors that Instant might encounter, and then set this to
false
.Declaration
Objective-C
@property (nonatomic) BOOL shouldShowCriticalErrors;
Swift
var shouldShowCriticalErrors: Bool { get set }
-
Please use this instead of
PDFConfiguration.default()
whenever dealing with Instant.InstantViewController
— and any subclass that you create — will use the object returned from this class property when you passnil
as theconfiguration
parameter toinit(document:, configuration:)
. This means you can globally set the defaults for your subclass by overriding this property and returning a customized object.Declaration
Objective-C
@property (class, nonatomic, readonly) PSPDFConfiguration *_Nonnull defaultConfiguration;
Swift
class var defaultConfiguration: PDFConfiguration { get }
-
The annotation group item that allows creating stand-alone Instant Comment threads.
You can use its identifier to remove the item in the annotation menu that is displayed after long pressing on the page. You can also use the item when creating a custom menu from scratch.
This item is only supported in the annotation creation menu (
createAnnotationMenuGroups
) that is shown when long pressing on an empty space on a page. Adding this item to the annotation toolbar (annotationToolbarController.annotationToolbar.configurations
) is not supported.Declaration
Objective-C
@property (class, nonatomic, readonly) PSPDFAnnotationGroupItem *_Nonnull instantCommentThreadItem;