PSPDFInteractionComponent
Objective-C
@interface PSPDFInteractionComponent<ContextType> : NSObject
Swift
class InteractionComponent<ContextType> : NSObject where ContextType : AnyObject
An object that encapsulates one or more user actions handled by the framework.
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
A boolean value that indicates whether the component is enabled or not. If this property is
false
, the component will not activate and all (if any) underlying gesture recognizers will transition toFailed
state.Declaration
Objective-C
@property (nonatomic, getter=isEnabled) BOOL enabled;
Swift
var isEnabled: Bool { get set }
-
Adds a condition block that will be evaluated before the component attempts to activate. If any condition block returns
false
, the component will not activate and all (if any) underlying gesture recognizers will transition toFailed
state.Note
If any condition block returns
false
, subsequent condition blocks will not be executed.Declaration
Objective-C
- (void)addActivationCondition: (nonnull BOOL (^)(ContextType _Nonnull, CGPoint, id<UICoordinateSpace> _Nonnull))conditionBlock;
Swift
func addActivationCondition(_ conditionBlock: @escaping (ContextType, CGPoint, UICoordinateSpace) -> Bool)
Parameters
conditionBlock
Condition block to add.
-
Checks if the component can activate at the given location. This method will first try to determine an activation context at the given location and then it will evaluate the previously added activation conditions, including the ones added by the framework itself.
Note
This method will respect the activation conditions of this interaction component but it will ignore the value of
enabled
property.Declaration
Objective-C
- (BOOL)canActivateAtPoint:(CGPoint)point inCoordinateSpace:(nonnull id<UICoordinateSpace>)coordinateSpace;
Swift
func canActivate(at point: CGPoint, in coordinateSpace: UICoordinateSpace) -> Bool
Parameters
point
Location of attempted activation.
coordinateSpace
Coordinate space of
point
.Return Value
true
if the interaction component can activate at the given location, otherwisefalse
. -
Adds a callback block that will be executed just before the component performs its action.
Note
It is too late to prevent the component from activating inside the callback block. For that, use
addActivationCondition
.Declaration
Objective-C
- (void)addActivationCallback: (nonnull void (^)(ContextType _Nonnull, CGPoint, id<UICoordinateSpace> _Nonnull))callbackBlock;
Swift
func addActivationCallback(_ callbackBlock: @escaping (ContextType, CGPoint, UICoordinateSpace) -> Void)
Parameters
callbackBlock
Callback block to add.
-
Check if this component contains the given gesture recognizer.
Declaration
Objective-C
- (BOOL)containsGestureRecognizer: (nonnull UIGestureRecognizer *)gestureRecognizer;
Swift
func contains(_ gestureRecognizer: UIGestureRecognizer) -> Bool
-
Creates a relationship with the given gesture recognizer that will prevent the gesture recognizers in this component from transitioning from
Possible
state untilotherGestureRecognizer
transitions toFailed
state.If
otherGestureRecognizer
transitions toBegan
orEnded
state then the gesture recognizers in this component will instead transition toFailed
state.Note
Not all components are backed by gesture recognizers, and some components can be backed by gesture recognizers just on one iOS version. Be sure to check documentation of individual components to learn more.
Declaration
Objective-C
- (void)requireGestureRecognizerToFail: (nonnull UIGestureRecognizer *)otherGestureRecognizer;
Swift
func require(toFail otherGestureRecognizer: UIGestureRecognizer)
Parameters
otherGestureRecognizer
Other gesture recognizer.
-
Creates a relationship with the given gesture recognizer that will allow the gesture recognizers in this component to transition out of
Possible
state at the same time asotherGestureRecognizer
.Note
Not all components are backed by gesture recognizers, and some components can be backed by gesture recognizers just on one iOS version. Be sure to check documentation of individual components to learn more.
Declaration
Objective-C
- (void)allowSimultaneousRecognitionWithGestureRecognizer: (nonnull UIGestureRecognizer *)otherGestureRecognizer;
Swift
func allowSimultaneousRecognition(with otherGestureRecognizer: UIGestureRecognizer)
Parameters
otherGestureRecognizer
Other gesture recognizer.