From 35a6abb3e6baaa7976b2147a0671cd14f89462da Mon Sep 17 00:00:00 2001 From: Ric Santos Date: Thu, 7 Nov 2019 15:32:36 +1030 Subject: [PATCH 1/2] Fix delegate property type --- MCSwipeTableViewCell/MCSwipeTableViewCell.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MCSwipeTableViewCell/MCSwipeTableViewCell.h b/MCSwipeTableViewCell/MCSwipeTableViewCell.h index 3cc5591..9eaca3f 100644 --- a/MCSwipeTableViewCell/MCSwipeTableViewCell.h +++ b/MCSwipeTableViewCell/MCSwipeTableViewCell.h @@ -57,7 +57,7 @@ typedef void (^MCSwipeCompletionBlock)(MCSwipeTableViewCell *cell, MCSwipeTableV @interface MCSwipeTableViewCell : UITableViewCell /** Delegate of `MCSwipeTableViewCell` */ -@property (nonatomic, assign) id delegate; +@property (nonatomic, weak) id delegate; /** * Damping of the physical spring animation. Expressed in percent. From 84cea7d0c37c5267c842e3fa9d1350c12c5be3af Mon Sep 17 00:00:00 2001 From: Ricardo Santos Date: Wed, 22 Jan 2020 13:33:17 +1030 Subject: [PATCH 2/2] Add manual trigger method with an animation paramater --- MCSwipeTableViewCell/MCSwipeTableViewCell.h | 5 +++++ MCSwipeTableViewCell/MCSwipeTableViewCell.m | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/MCSwipeTableViewCell/MCSwipeTableViewCell.h b/MCSwipeTableViewCell/MCSwipeTableViewCell.h index 9eaca3f..8687406 100644 --- a/MCSwipeTableViewCell/MCSwipeTableViewCell.h +++ b/MCSwipeTableViewCell/MCSwipeTableViewCell.h @@ -179,6 +179,11 @@ typedef void (^MCSwipeCompletionBlock)(MCSwipeTableViewCell *cell, MCSwipeTableV */ - (void)triggerState1; +/** + * Trigger state 1 as if the user had swiped and released, and specify the animation duration + */ +- (void)triggerState1WithDuration:(NSTimeInterval)duration; + @end diff --git a/MCSwipeTableViewCell/MCSwipeTableViewCell.m b/MCSwipeTableViewCell/MCSwipeTableViewCell.m index 41ca849..227c7cb 100644 --- a/MCSwipeTableViewCell/MCSwipeTableViewCell.m +++ b/MCSwipeTableViewCell/MCSwipeTableViewCell.m @@ -645,7 +645,11 @@ - (void)swipeToOriginWithCompletion:(void(^)(void))completion { #pragma mark - Trigger Manually - (void)triggerState1 { - [UIView animateWithDuration:0.15f animations:^{ + [self triggerState1WithDuration:0.15]; +} + +- (void)triggerState1WithDuration:(NSTimeInterval)duration { + [UIView animateWithDuration:duration animations:^{ [self animateSliderWithXTranslation:-70.f animationDuration:0 hasEnded:NO]; } completion:^(BOOL finished) { [self animateSliderWithXTranslation:0.f animationDuration:0 hasEnded:YES];