You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It makes sense that any delegation related to the component should be handled in the component controller.
I would like to implement UIGestureRecognizerDelegate in the controller, but since I am creating the CKComponentPanGestureAttribute in the component +new method, how this is done isn't to obvious just by reading the documentation on component controllers.
For instance the following case creating a text component which has a pan attached to it:
CKTextComponent *text = [CKTextComponent newWithTextAttributes:{
.attributedString = [attString copy],
.truncationAttributedString = [NSAttributedStringmoreAttributedString],
.maximumNumberOfLines = static_cast<NSUInteger>([state boolValue] ? 0 : 4)
}viewAttributes:{
{@selector(setBackgroundColor:),[UIColor clearColor]},
{CKComponentActionAttribute(@selector(didTapContinueReading))},
{CKComponentPanGestureAttribute(@selector(didPan:gesture:))} // I've implemented this method in the controller class// How do I set the delegate of the yet to be created pan gesture?
}accessibilityContext:{
}];
Furthermore, since the components model should be immutable , it wouldn't make sense for the controller to "kidnap" the gesture recognizer in the lifecycle methods (such as - (void)didMount)
What am I missing?
The text was updated successfully, but these errors were encountered:
Some might consider this to be too much "magic", but perhaps when the component controller implements UIGestureRecognizer, the functions provided by CKComponentGestureActions.h could automatically assign the controller as the delegate.
For now though, I'm not sure if there's a better alternative besides ditching CKComponentPanGestureAttribute, and instead handling the construction and delegate assignment of the gesture recognizer inside a component controller.
While the controller isn't the delegate of the gesture, it is on the responder chain for the gesture. So, you should just implement -didPan:gesture: in your controller and boom.
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
Reading up on component controllers -
It makes sense that any delegation related to the component should be handled in the component controller.
I would like to implement
UIGestureRecognizerDelegate
in the controller, but since I am creating theCKComponentPanGestureAttribute
in the component+new
method, how this is done isn't to obvious just by reading the documentation on component controllers.For instance the following case creating a text component which has a pan attached to it:
Furthermore, since the components model should be immutable , it wouldn't make sense for the controller to "kidnap" the gesture recognizer in the lifecycle methods (such as
- (void)didMount
)What am I missing?
The text was updated successfully, but these errors were encountered: