Skip to content

Commit

Permalink
(fix/delegate,threshold): Threshold delegate call only triggers the m…
Browse files Browse the repository at this point in the history
…oment state changes, otherwise the didSwipe callback can be used to continuously monitor state changes on every gesture change
  • Loading branch information
bitwit committed Apr 3, 2016
1 parent 793190b commit f926d36
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions BWSwipeRevealCell/BWSwipeCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,20 @@ public class BWSwipeCell:UITableViewCell {
public func animateContentViewForPoint(point: CGPoint) {
if (point.x > 0 && self.revealDirection == .Left) || (point.x < 0 && self.revealDirection == .Right) || self.revealDirection == .Both {
self.contentView.frame = CGRectOffset(self.contentView.bounds, point.x, 0)
let previousState = state
if point.x >= self.threshold {
self.state = .PastThresholdLeft
self.delegate?.swipeCellDidPassThreshold?(self)
}
else if point.x < -self.threshold {
self.state = .PastThresholdRight
self.delegate?.swipeCellDidPassThreshold?(self)
}
else {
self.state = .Normal
}

if self.state != .Normal && self.state != previousState {
self.delegate?.swipeCellDidPassThreshold?(self)
}
self.delegate?.swipeCellDidSwipe?(self)
}
else {
Expand Down

0 comments on commit f926d36

Please sign in to comment.