123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- #import <UIKit/UIKit.h>
- #import "MGSwipeButton.h"
- typedef NS_ENUM(NSInteger, MGSwipeTransition) {
- MGSwipeTransitionBorder = 0,
- MGSwipeTransitionStatic,
- MGSwipeTransitionDrag,
- MGSwipeTransitionClipCenter,
- MGSwipeTransitionRotate3D
- };
- #define MGSwipeTransition3D MGSwipeTransitionRotate3D
- #define MGSwipeStateSwippingLeftToRight MGSwipeStateSwipingLeftToRight
- #define MGSwipeStateSwippingRightToLeft MGSwipeStateSwipingRightToLeft
- typedef NS_ENUM(NSInteger, MGSwipeDirection) {
- MGSwipeDirectionLeftToRight = 0,
- MGSwipeDirectionRightToLeft
- };
- typedef NS_ENUM(NSInteger, MGSwipeState) {
- MGSwipeStateNone = 0,
- MGSwipeStateSwipingLeftToRight,
- MGSwipeStateSwipingRightToLeft,
- MGSwipeStateExpandingLeftToRight,
- MGSwipeStateExpandingRightToLeft,
- };
- typedef NS_ENUM(NSInteger, MGSwipeExpansionLayout) {
- MGSwipeExpansionLayoutBorder = 0,
- MGSwipeExpansionLayoutCenter,
- MGSwipeExpansionLayoutNone
- };
- typedef NS_ENUM(NSInteger, MGSwipeEasingFunction) {
- MGSwipeEasingFunctionLinear = 0,
- MGSwipeEasingFunctionQuadIn,
- MGSwipeEasingFunctionQuadOut,
- MGSwipeEasingFunctionQuadInOut,
- MGSwipeEasingFunctionCubicIn,
- MGSwipeEasingFunctionCubicOut,
- MGSwipeEasingFunctionCubicInOut,
- MGSwipeEasingFunctionBounceIn,
- MGSwipeEasingFunctionBounceOut,
- MGSwipeEasingFunctionBounceInOut
- };
- @interface MGSwipeAnimation : NSObject
- @property (nonatomic, assign) CGFloat duration;
- @property (nonatomic, assign) MGSwipeEasingFunction easingFunction;
- -(CGFloat) value:(CGFloat) elapsed duration:(CGFloat) duration from:(CGFloat) from to:(CGFloat) to;
- @end
- @interface MGSwipeSettings: NSObject
- @property (nonatomic, assign) MGSwipeTransition transition;
- @property (nonatomic, assign) CGFloat threshold;
- @property (nonatomic, assign) CGFloat offset;
- @property (nonatomic, assign) CGFloat topMargin;
- @property (nonatomic, assign) CGFloat bottomMargin;
- @property (nonatomic, assign) CGFloat buttonsDistance;
- @property (nonatomic, strong, nonnull) MGSwipeAnimation * showAnimation;
- @property (nonatomic, strong, nonnull) MGSwipeAnimation * hideAnimation;
- @property (nonatomic, strong, nonnull) MGSwipeAnimation * stretchAnimation;
- @property (nonatomic, assign) CGFloat animationDuration DEPRECATED_ATTRIBUTE;
- @property (nonatomic, assign) BOOL keepButtonsSwiped;
- @property (nonatomic, assign) BOOL onlySwipeButtons;
- @property (nonatomic, assign) BOOL enableSwipeBounces;
- @property (nonatomic, assign) CGFloat swipeBounceRate;
- @end
- @interface MGSwipeExpansionSettings: NSObject
- @property (nonatomic, assign) NSInteger buttonIndex;
- @property (nonatomic, assign) BOOL fillOnTrigger;
- @property (nonatomic, assign) CGFloat threshold;
- @property (nonatomic, strong, nullable) UIColor * expansionColor;
- @property (nonatomic, assign) MGSwipeExpansionLayout expansionLayout;
- @property (nonatomic, strong, nonnull) MGSwipeAnimation * triggerAnimation;
- @property (nonatomic, assign) CGFloat animationDuration;
- @end
- @class MGSwipeTableCell;
- @protocol MGSwipeTableCellDelegate <NSObject>
- @optional
- -(BOOL) swipeTableCell:(nonnull MGSwipeTableCell*) cell canSwipe:(MGSwipeDirection) direction fromPoint:(CGPoint) point;
- -(BOOL) swipeTableCell:(nonnull MGSwipeTableCell*) cell canSwipe:(MGSwipeDirection) direction DEPRECATED_ATTRIBUTE;
- -(void) swipeTableCell:(nonnull MGSwipeTableCell*) cell didChangeSwipeState:(MGSwipeState) state gestureIsActive:(BOOL) gestureIsActive;
- -(BOOL) swipeTableCell:(nonnull MGSwipeTableCell*) cell tappedButtonAtIndex:(NSInteger) index direction:(MGSwipeDirection)direction fromExpansion:(BOOL) fromExpansion;
- -(nullable NSArray<UIView*>*) swipeTableCell:(nonnull MGSwipeTableCell*) cell swipeButtonsForDirection:(MGSwipeDirection)direction
- swipeSettings:(nonnull MGSwipeSettings*) swipeSettings expansionSettings:(nonnull MGSwipeExpansionSettings*) expansionSettings;
- -(BOOL) swipeTableCell:(nonnull MGSwipeTableCell *)cell shouldHideSwipeOnTap:(CGPoint) point;
- -(void) swipeTableCellWillBeginSwiping:(nonnull MGSwipeTableCell *) cell;
- -(void) swipeTableCellWillEndSwiping:(nonnull MGSwipeTableCell *) cell;
- @end
- @interface MGSwipeTableCell : UITableViewCell
- @property (nonatomic, weak, nullable) id<MGSwipeTableCellDelegate> delegate;
- @property (nonatomic, strong, readonly, nonnull) UIView * swipeContentView;
- @property (nonatomic, copy, nonnull) NSArray<UIView*> * leftButtons;
- @property (nonatomic, copy, nonnull) NSArray<UIView*> * rightButtons;
- @property (nonatomic, strong, nonnull) MGSwipeSettings * leftSwipeSettings;
- @property (nonatomic, strong, nonnull) MGSwipeSettings * rightSwipeSettings;
- @property (nonatomic, strong, nonnull) MGSwipeExpansionSettings * leftExpansion;
- @property (nonatomic, strong, nonnull) MGSwipeExpansionSettings * rightExpansion;
- @property (nonatomic, readonly) MGSwipeState swipeState;
- @property (nonatomic, readonly) BOOL isSwipeGestureActive;
- @property (nonatomic) BOOL allowsMultipleSwipe;
- @property (nonatomic) BOOL allowsButtonsWithDifferentWidth;
- @property (nonatomic) BOOL allowsSwipeWhenTappingButtons;
- @property (nonatomic) BOOL allowsOppositeSwipe;
- @property (nonatomic) BOOL preservesSelectionStatus;
- @property (nonatomic) BOOL touchOnDismissSwipe;
- @property (nonatomic, strong, nullable) UIColor * swipeBackgroundColor;
- @property (nonatomic, assign) CGFloat swipeOffset;
- -(void) hideSwipeAnimated: (BOOL) animated;
- -(void) hideSwipeAnimated: (BOOL) animated completion:(nullable void(^)(BOOL finished)) completion;
- -(void) showSwipe: (MGSwipeDirection) direction animated: (BOOL) animated;
- -(void) showSwipe: (MGSwipeDirection) direction animated: (BOOL) animated completion:(nullable void(^)(BOOL finished)) completion;
- -(void) setSwipeOffset:(CGFloat)offset animated: (BOOL) animated completion:(nullable void(^)(BOOL finished)) completion;
- -(void) setSwipeOffset:(CGFloat)offset animation: (nullable MGSwipeAnimation *) animation completion:(nullable void(^)(BOOL finished)) completion;
- -(void) expandSwipe: (MGSwipeDirection) direction animated: (BOOL) animated;
- -(void) refreshContentView;
- -(void) refreshButtons: (BOOL) usingDelegate;
- @end
|