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 to.failed
state.Declaration
Objective-C
@property (nonatomic, getter=isEnabled) BOOL enabled;
Swift
var isEnabled: Bool { get set }
-
Add 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 to.failed
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)
-
Check 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
Return Value
true
if the interaction component can activate at the given location, otherwisefalse
. -
Add 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
. -
Check if this component contains the given gesture recognizer.
Declaration
Objective-C
- (BOOL)containsGestureRecognizer: (nonnull UIGestureRecognizer *)gestureRecognizer;
Swift
func contains(_ gestureRecognizer: UIGestureRecognizer) -> Bool
Return Value
true
if the givengestureRecognizer
is managed by this component, otherwisefalse
. -
Create a relationship with the given gesture recognizer that will prevent the gesture recognizers in this component from transitioning from
.possible
state untilotherGestureRecognizer
transitions to.failed
state.If
otherGestureRecognizer
transitions to.began
or.ended
state then the gesture recognizers in this component will instead transition to.failed
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)
-
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)