Skip to content

Commit

Permalink
(fix/interfaces): Make all internal functions public. Make release co…
Browse files Browse the repository at this point in the history
…mpletion block public.
  • Loading branch information
bitwit committed Jun 28, 2016
1 parent a30b5c7 commit 63ed892
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
22 changes: 11 additions & 11 deletions BWSwipeRevealCell/BWSwipeCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class BWSwipeCell:UITableViewCell {
// BWSwipeCell Delegate
public weak var delegate: BWSwipeCellDelegate?

private lazy var releaseCompletionBlock:((Bool) -> Void)? = {
public lazy var releaseCompletionBlock:((Bool) -> Void)? = {
return {
[weak self] (finished: Bool) in

Expand Down Expand Up @@ -102,7 +102,7 @@ public class BWSwipeCell:UITableViewCell {
self.state = .Normal
}

func handlePanGesture(panGestureRecognizer: UIPanGestureRecognizer) {
public func handlePanGesture(panGestureRecognizer: UIPanGestureRecognizer) {
let translation: CGPoint = panGestureRecognizer.translationInView(panGestureRecognizer.view)
var panOffset: CGFloat = translation.x

Expand Down Expand Up @@ -136,7 +136,7 @@ public class BWSwipeCell:UITableViewCell {
}
}

func didStartSwiping() {
public func didStartSwiping() {
self.delegate?.swipeCellDidStartSwiping?(self)
}

Expand Down Expand Up @@ -179,7 +179,7 @@ public class BWSwipeCell:UITableViewCell {

// MARK: - Reset animations

func animateCellSpringRelease() {
public func animateCellSpringRelease() {
UIView.animateWithDuration(self.animationDuration,
delay: 0,
options: .CurveEaseOut,
Expand All @@ -189,7 +189,7 @@ public class BWSwipeCell:UITableViewCell {
completion: self.releaseCompletionBlock)
}

func animateCellSlidingDoor() {
public func animateCellSlidingDoor() {
UIView.animateWithDuration(self.animationDuration,
delay: 0,
options: .AllowUserInteraction,
Expand All @@ -204,7 +204,7 @@ public class BWSwipeCell:UITableViewCell {
completion: self.releaseCompletionBlock)
}

func animateCellSwipeThrough() {
public func animateCellSwipeThrough() {
UIView.animateWithDuration(self.animationDuration,
delay: 0,
options: UIViewAnimationOptions.CurveLinear,
Expand All @@ -216,26 +216,26 @@ public class BWSwipeCell:UITableViewCell {

// MARK: - UITableViewCell Overrides

override public init(style: UITableViewCellStyle, reuseIdentifier: String?) {
public override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.initialize()
}

required public init?(coder aDecoder: NSCoder) {
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initialize()
}

override public func prepareForReuse() {
public override func prepareForReuse() {
super.prepareForReuse()
self.cleanUp()
}

override public func setSelected(selected: Bool, animated: Bool) {
public override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}

override public func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {
public override func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {
if gestureRecognizer.isKindOfClass(UIPanGestureRecognizer) && self.revealDirection != .None {
let pan:UIPanGestureRecognizer = gestureRecognizer as! UIPanGestureRecognizer
let translation: CGPoint = pan.translationInView(self.superview)
Expand Down
18 changes: 9 additions & 9 deletions BWSwipeRevealCell/BWSwipeRevealCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class BWSwipeRevealCell: BWSwipeCell {
public var bgViewRightImage: UIImage?

private var _leftBackButton: UIButton?
var leftBackButton:UIButton? {
public var leftBackButton:UIButton? {
if _leftBackButton == nil {
_leftBackButton = UIButton(frame: CGRectMake(0, 0, CGRectGetHeight(self.frame), CGRectGetHeight(self.frame)))
_leftBackButton!.setImage(self.bgViewLeftImage, forState: .Normal)
Expand All @@ -47,7 +47,7 @@ public class BWSwipeRevealCell: BWSwipeCell {
}

private var _rightBackButton: UIButton?
var rightBackButton:UIButton? {
public var rightBackButton:UIButton? {
if _rightBackButton == nil {
_rightBackButton = UIButton(frame: CGRectMake(CGRectGetMaxX(self.contentView.frame), 0, CGRectGetHeight(self.frame), CGRectGetHeight(self.frame)))
_rightBackButton!.setImage(self.bgViewRightImage, forState: .Normal)
Expand Down Expand Up @@ -91,7 +91,7 @@ public class BWSwipeRevealCell: BWSwipeCell {
}
}

override func didStartSwiping() {
public override func didStartSwiping() {
super.didStartSwiping()
self.backgroundView!.addSubview(self.backView!)
}
Expand Down Expand Up @@ -130,7 +130,7 @@ public class BWSwipeRevealCell: BWSwipeCell {

// MARK: - Reveal Cell Animations

override func animateCellSpringRelease() {
public override func animateCellSpringRelease() {
super.animateCellSpringRelease()
let pointX = self.contentView.frame.origin.x
UIView.animateWithDuration(self.animationDuration,
Expand All @@ -145,7 +145,7 @@ public class BWSwipeRevealCell: BWSwipeCell {
}, completion: nil)
}

override func animateCellSwipeThrough() {
public override func animateCellSwipeThrough() {
super.animateCellSwipeThrough()
let pointX = self.contentView.frame.origin.x
UIView.animateWithDuration(self.animationDuration,
Expand All @@ -160,14 +160,14 @@ public class BWSwipeRevealCell: BWSwipeCell {
}, completion: nil)
}

override func animateCellSlidingDoor() {
public override func animateCellSlidingDoor() {
super.animateCellSlidingDoor()
self.shouldCleanUpBackView = false
}

// MARK: - Reveal Cell

func getBackgroundViewImagesMaxX(x:CGFloat) -> CGFloat {
public func getBackgroundViewImagesMaxX(x:CGFloat) -> CGFloat {
if x > 0 {
let frame = self.leftBackButton!.frame
if self.type == .SwipeThrough {
Expand All @@ -185,14 +185,14 @@ public class BWSwipeRevealCell: BWSwipeCell {
}
}

func leftButtonTapped () {
public func leftButtonTapped () {
self.shouldCleanUpBackView = true
self.animateCellSpringRelease()
let delegate = self.delegate as? BWSwipeRevealCellDelegate
delegate?.swipeCellActivatedAction?(self, isActionLeft: true)
}

func rightButtonTapped () {
public func rightButtonTapped () {
self.shouldCleanUpBackView = true
self.animateCellSpringRelease()
let delegate = self.delegate as? BWSwipeRevealCellDelegate
Expand Down

0 comments on commit 63ed892

Please sign in to comment.