diff --git a/BWSwipeRevealCell.xcodeproj/project.pbxproj b/BWSwipeRevealCell.xcodeproj/project.pbxproj index 2f004e7..4f7f67f 100644 --- a/BWSwipeRevealCell.xcodeproj/project.pbxproj +++ b/BWSwipeRevealCell.xcodeproj/project.pbxproj @@ -9,8 +9,8 @@ /* Begin PBXBuildFile section */ 752EDC641BF64B5B007ED36D /* BWSwipeRevealCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 752EDC631BF64B5B007ED36D /* BWSwipeRevealCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; 752EDC6C1BF65169007ED36D /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 752EDC6B1BF65169007ED36D /* README.md */; }; - 752EDC6F1BF654F8007ED36D /* BWSwipeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752EDC6D1BF654F8007ED36D /* BWSwipeCell.swift */; }; - 752EDC701BF654F8007ED36D /* BWSwipeRevealCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752EDC6E1BF654F8007ED36D /* BWSwipeRevealCell.swift */; }; + 752EDC6F1BF654F8007ED36D /* SwipeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752EDC6D1BF654F8007ED36D /* SwipeCell.swift */; }; + 752EDC701BF654F8007ED36D /* SwipeRevealCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752EDC6E1BF654F8007ED36D /* SwipeRevealCell.swift */; }; 752EDC781BF65880007ED36D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752EDC771BF65880007ED36D /* AppDelegate.swift */; }; 752EDC7B1BF65880007ED36D /* BWSwipeRevealCellExample.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 752EDC791BF65880007ED36D /* BWSwipeRevealCellExample.xcdatamodeld */; }; 752EDC7D1BF65880007ED36D /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752EDC7C1BF65880007ED36D /* MasterViewController.swift */; }; @@ -18,7 +18,7 @@ 752EDC871BF65880007ED36D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 752EDC851BF65880007ED36D /* LaunchScreen.storyboard */; }; 752EDC8D1BF659C7007ED36D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 752EDC8C1BF659C7007ED36D /* Assets.xcassets */; }; 752EDC8F1BF65C68007ED36D /* example.gif in Resources */ = {isa = PBXBuildFile; fileRef = 752EDC8E1BF65C68007ED36D /* example.gif */; }; - 7563A67C1D09C82400A53142 /* BWSwipeableViewHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7563A67B1D09C82400A53142 /* BWSwipeableViewHandler.swift */; }; + 7563A67C1D09C82400A53142 /* SwipeViewHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7563A67B1D09C82400A53142 /* SwipeViewHandler.swift */; }; 75ABE4201C0F88AD00F42894 /* BWSwipeRevealCell.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 752EDC601BF64B5B007ED36D /* BWSwipeRevealCell.framework */; }; 75ABE4221C0F8AF300F42894 /* BWSwipeRevealCell.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 752EDC601BF64B5B007ED36D /* BWSwipeRevealCell.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ @@ -52,8 +52,8 @@ 752EDC631BF64B5B007ED36D /* BWSwipeRevealCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BWSwipeRevealCell.h; sourceTree = ""; }; 752EDC651BF64B5B007ED36D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 752EDC6B1BF65169007ED36D /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - 752EDC6D1BF654F8007ED36D /* BWSwipeCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BWSwipeCell.swift; sourceTree = ""; }; - 752EDC6E1BF654F8007ED36D /* BWSwipeRevealCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BWSwipeRevealCell.swift; sourceTree = ""; }; + 752EDC6D1BF654F8007ED36D /* SwipeCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwipeCell.swift; sourceTree = ""; }; + 752EDC6E1BF654F8007ED36D /* SwipeRevealCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwipeRevealCell.swift; sourceTree = ""; }; 752EDC751BF65880007ED36D /* BWSwipeRevealCellExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BWSwipeRevealCellExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 752EDC771BF65880007ED36D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 752EDC7A1BF65880007ED36D /* BWSwipeRevealCellExample.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = BWSwipeRevealCellExample.xcdatamodel; sourceTree = ""; }; @@ -63,7 +63,7 @@ 752EDC881BF65880007ED36D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 752EDC8C1BF659C7007ED36D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 752EDC8E1BF65C68007ED36D /* example.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = example.gif; sourceTree = ""; }; - 7563A67B1D09C82400A53142 /* BWSwipeableViewHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BWSwipeableViewHandler.swift; sourceTree = ""; }; + 7563A67B1D09C82400A53142 /* SwipeViewHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwipeViewHandler.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -108,9 +108,9 @@ 752EDC621BF64B5B007ED36D /* BWSwipeRevealCell */ = { isa = PBXGroup; children = ( - 7563A67B1D09C82400A53142 /* BWSwipeableViewHandler.swift */, - 752EDC6D1BF654F8007ED36D /* BWSwipeCell.swift */, - 752EDC6E1BF654F8007ED36D /* BWSwipeRevealCell.swift */, + 7563A67B1D09C82400A53142 /* SwipeViewHandler.swift */, + 752EDC6D1BF654F8007ED36D /* SwipeCell.swift */, + 752EDC6E1BF654F8007ED36D /* SwipeRevealCell.swift */, 752EDC631BF64B5B007ED36D /* BWSwipeRevealCell.h */, 752EDC651BF64B5B007ED36D /* Info.plist */, ); @@ -248,9 +248,9 @@ buildActionMask = 2147483647; files = ( 752EDC6C1BF65169007ED36D /* README.md in Sources */, - 7563A67C1D09C82400A53142 /* BWSwipeableViewHandler.swift in Sources */, - 752EDC701BF654F8007ED36D /* BWSwipeRevealCell.swift in Sources */, - 752EDC6F1BF654F8007ED36D /* BWSwipeCell.swift in Sources */, + 7563A67C1D09C82400A53142 /* SwipeViewHandler.swift in Sources */, + 752EDC701BF654F8007ED36D /* SwipeRevealCell.swift in Sources */, + 752EDC6F1BF654F8007ED36D /* SwipeCell.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/BWSwipeRevealCell/BWSwipeCell.swift b/BWSwipeRevealCell/SwipeCell.swift similarity index 56% rename from BWSwipeRevealCell/BWSwipeCell.swift rename to BWSwipeRevealCell/SwipeCell.swift index 44a7097..7cfc2f3 100644 --- a/BWSwipeRevealCell/BWSwipeCell.swift +++ b/BWSwipeRevealCell/SwipeCell.swift @@ -9,18 +9,18 @@ import Foundation import UIKit -@objc public protocol BWSwipeCellDelegate: NSObjectProtocol { - @objc optional func swipeCellDidStartSwiping(_ cell: BWSwipeCell) - @objc optional func swipeCellDidSwipe(_ cell: BWSwipeCell) - @objc optional func swipeCellWillRelease(_ cell: BWSwipeCell) - @objc optional func swipeCellDidCompleteRelease(_ cell: BWSwipeCell) - @objc optional func swipeCellDidChangeState(_ cell: BWSwipeCell) +@objc public protocol SwipeCellDelegate: NSObjectProtocol { + @objc optional func swipeCellDidStartSwiping(_ cell: SwipeCell) + @objc optional func swipeCellDidSwipe(_ cell: SwipeCell) + @objc optional func swipeCellWillRelease(_ cell: SwipeCell) + @objc optional func swipeCellDidCompleteRelease(_ cell: SwipeCell) + @objc optional func swipeCellDidChangeState(_ cell: SwipeCell) } -public class BWSwipeCell: UITableViewCell { +public class SwipeCell: UITableViewCell { - public private(set) var swipeHandler: BWSwipeViewHandler! - public var delegate: BWSwipeCellDelegate? + public private(set) var swipeHandler: SwipeViewHandler! + public var delegate: SwipeCellDelegate? override public init(style: UITableViewCellStyle, reuseIdentifier: String?) { @@ -54,30 +54,30 @@ public class BWSwipeCell: UITableViewCell { backgroundView = bv } - swipeHandler = BWSwipeViewHandler(contentView: contentView, backgroundView: bv) + swipeHandler = SwipeViewHandler(contentView: contentView, backgroundView: bv) swipeHandler.delegate = self } } -extension BWSwipeCell: BWSwipeViewHandlerDelegate { +extension SwipeCell: SwipeViewHandlerDelegate { - public func swipeViewDidStartSwiping(_ handler: BWSwipeViewHandler) { + public func swipeViewDidStartSwiping(_ handler: SwipeViewHandler) { delegate?.swipeCellDidStartSwiping?(self) } - public func swipeViewDidSwipe(_ handler: BWSwipeViewHandler) { + public func swipeViewDidSwipe(_ handler: SwipeViewHandler) { delegate?.swipeCellDidSwipe?(self) } - public func swipeViewWillRelease(_ handler: BWSwipeViewHandler) { + public func swipeViewWillRelease(_ handler: SwipeViewHandler) { delegate?.swipeCellWillRelease?(self) } - public func swipeViewDidCompleteRelease(_ handler: BWSwipeViewHandler) { + public func swipeViewDidCompleteRelease(_ handler: SwipeViewHandler) { delegate?.swipeCellDidCompleteRelease?(self) } - public func swipeViewDidChangeState(_ handler: BWSwipeViewHandler) { + public func swipeViewDidChangeState(_ handler: SwipeViewHandler) { delegate?.swipeCellDidChangeState?(self) } diff --git a/BWSwipeRevealCell/BWSwipeRevealCell.swift b/BWSwipeRevealCell/SwipeRevealCell.swift similarity index 90% rename from BWSwipeRevealCell/BWSwipeRevealCell.swift rename to BWSwipeRevealCell/SwipeRevealCell.swift index 531ac16..9dec5c0 100644 --- a/BWSwipeRevealCell/BWSwipeRevealCell.swift +++ b/BWSwipeRevealCell/SwipeRevealCell.swift @@ -1,6 +1,6 @@ // -// BWSwipeRevealCell.swift -// BWSwipeCell +// SwipeRevealCell.swift +// SwipeCell // // Created by Kyle Newsome on 2015-11-10. // Copyright © 2015 Kyle Newsome. All rights reserved. @@ -9,11 +9,11 @@ import Foundation import UIKit -@objc public protocol BWSwipeRevealCellDelegate:BWSwipeCellDelegate { - @objc optional func swipeCellActivatedAction(_ cell: BWSwipeCell, isActionLeft: Bool) +@objc public protocol SwipeRevealCellDelegate:SwipeCellDelegate { + @objc optional func swipeCellActivatedAction(_ cell: SwipeCell, isActionLeft: Bool) } -public class BWSwipeRevealCell: BWSwipeCell { +public class SwipeRevealCell: SwipeCell { public var backViewbackgroundColor: UIColor = UIColor(white: 0.92, alpha: 1) private var _backView: UIView? @@ -38,7 +38,7 @@ public class BWSwipeRevealCell: BWSwipeCell { if _leftBackButton == nil { _leftBackButton = UIButton(frame: CGRect(x: 0, y: 0, width: self.frame.height, height: self.frame.height)) _leftBackButton!.setImage(self.bgViewLeftImage, for: UIControlState()) - _leftBackButton!.addTarget(self, action: #selector(BWSwipeRevealCell.leftButtonTapped), for: .touchUpInside) + _leftBackButton!.addTarget(self, action: #selector(SwipeRevealCell.leftButtonTapped), for: .touchUpInside) _leftBackButton!.tintColor = UIColor.white() _leftBackButton!.contentMode = .center self.backView!.addSubview(_leftBackButton!) @@ -51,7 +51,7 @@ public class BWSwipeRevealCell: BWSwipeCell { if _rightBackButton == nil { _rightBackButton = UIButton(frame: CGRect(x: self.contentView.frame.maxX, y: 0, width: self.frame.height, height: self.frame.height)) _rightBackButton!.setImage(self.bgViewRightImage, for: UIControlState()) - _rightBackButton!.addTarget(self, action: #selector(BWSwipeRevealCell.rightButtonTapped), for: .touchUpInside) + _rightBackButton!.addTarget(self, action: #selector(SwipeRevealCell.rightButtonTapped), for: .touchUpInside) _rightBackButton!.tintColor = UIColor.white() _rightBackButton!.contentMode = .center self.backView!.addSubview(_rightBackButton!) @@ -91,13 +91,13 @@ public class BWSwipeRevealCell: BWSwipeCell { super.layoutSubviews() } - override public func swipeViewDidStartSwiping(_ handler: BWSwipeViewHandler) { + override public func swipeViewDidStartSwiping(_ handler: SwipeViewHandler) { super.swipeViewDidStartSwiping(handler) self.backgroundView!.addSubview(self.backView!) } - override public func swipeViewWillRelease(_ handler: BWSwipeViewHandler) { + override public func swipeViewWillRelease(_ handler: SwipeViewHandler) { super.swipeViewWillRelease(handler) @@ -110,7 +110,7 @@ public class BWSwipeRevealCell: BWSwipeCell { } } - override public func swipeViewDidSwipe(_ handler: BWSwipeViewHandler) { + override public func swipeViewDidSwipe(_ handler: SwipeViewHandler) { super.swipeViewDidSwipe(handler) //TODO: integrate with content animation @@ -211,15 +211,14 @@ public class BWSwipeRevealCell: BWSwipeCell { public func leftButtonTapped () { self.shouldCleanUpBackView = true self.animateCellSpringRelease() - let delegate = self.delegate as? BWSwipeRevealCellDelegate + let delegate = self.delegate as? SwipeRevealCellDelegate delegate?.swipeCellActivatedAction?(self, isActionLeft: true) } public func rightButtonTapped () { self.shouldCleanUpBackView = true self.animateCellSpringRelease() - let delegate = self.delegate as? BWSwipeRevealCellDelegate + let delegate = self.delegate as? SwipeRevealCellDelegate delegate?.swipeCellActivatedAction?(self, isActionLeft: false) } - } diff --git a/BWSwipeRevealCell/BWSwipeableViewHandler.swift b/BWSwipeRevealCell/SwipeViewHandler.swift similarity index 85% rename from BWSwipeRevealCell/BWSwipeableViewHandler.swift rename to BWSwipeRevealCell/SwipeViewHandler.swift index fce9b43..9d87579 100644 --- a/BWSwipeRevealCell/BWSwipeableViewHandler.swift +++ b/BWSwipeRevealCell/SwipeViewHandler.swift @@ -2,47 +2,47 @@ import Foundation import UIKit -@objc public protocol BWSwipeViewHandlerDelegate: NSObjectProtocol { - @objc optional func swipeViewDidStartSwiping(_ handler: BWSwipeViewHandler) - @objc optional func swipeViewDidSwipe(_ handler: BWSwipeViewHandler) - @objc optional func swipeViewWillRelease(_ handler: BWSwipeViewHandler) - @objc optional func swipeViewDidCompleteRelease(_ handler: BWSwipeViewHandler) - @objc optional func swipeViewDidChangeState(_ handler: BWSwipeViewHandler) +@objc public protocol SwipeViewHandlerDelegate: NSObjectProtocol { + @objc optional func swipeViewDidStartSwiping(_ handler: SwipeViewHandler) + @objc optional func swipeViewDidSwipe(_ handler: SwipeViewHandler) + @objc optional func swipeViewWillRelease(_ handler: SwipeViewHandler) + @objc optional func swipeViewDidCompleteRelease(_ handler: SwipeViewHandler) + @objc optional func swipeViewDidChangeState(_ handler: SwipeViewHandler) } //Defines the interaction type of the table cell -public enum BWSwipeCellType: Int { +public enum InteractionType: Int { case swipeThrough = 0 // swipes with finger and animates through case springRelease // resists pulling and bounces back case slidingDoor // swipe to a stopping position where underlying buttons can be revealed } -public enum BWSwipeCellRevealDirection { +public enum SwipeDirection { case none case both case right case left } -public enum BWSwipeCellState { +public enum State { case normal case pastThresholdLeft case pastThresholdRight } -public class BWSwipeViewHandler: NSObject, UIGestureRecognizerDelegate { +public class SwipeViewHandler: NSObject { public let backgroundView: UIView public let contentView: UIView // The interaction type for this table cell - public var type: BWSwipeCellType = .springRelease + public var type: InteractionType = .springRelease // The allowable swipe direction(s) - public var revealDirection: BWSwipeCellRevealDirection = .both + public var revealDirection: SwipeDirection = .both // The current state of the cell (either normal or past a threshold) - public private(set) var state: BWSwipeCellState = .normal + public private(set) var state: State = .normal // The point at which pan elasticity starts, and `state` changes. Defaults to the height of the `UITableViewCell` (i.e. when it form a perfect square) public lazy var threshold: CGFloat = { @@ -67,9 +67,9 @@ public class BWSwipeViewHandler: NSObject, UIGestureRecognizerDelegate { public var animationDuration: Double = 0.2 // BWSwipeCell Delegate - public weak var delegate: BWSwipeViewHandlerDelegate? + public weak var delegate: SwipeViewHandlerDelegate? - private lazy var releaseCompletionBlock:((Bool) -> Void)? = { + public lazy var releaseCompletionBlock:((Bool) -> Void)? = { return { [weak self] (finished: Bool) in @@ -91,7 +91,7 @@ public class BWSwipeViewHandler: NSObject, UIGestureRecognizerDelegate { super.init() - let panGestureRecognizer: UIPanGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(BWSwipeViewHandler.handlePanGesture(_:))) + let panGestureRecognizer: UIPanGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(SwipeViewHandler.handlePanGesture(_:))) panGestureRecognizer.delegate = self contentView.addGestureRecognizer(panGestureRecognizer) } @@ -102,7 +102,7 @@ public class BWSwipeViewHandler: NSObject, UIGestureRecognizerDelegate { self.state = .normal } - func handlePanGesture(_ panGestureRecognizer: UIPanGestureRecognizer) { + public func handlePanGesture(_ panGestureRecognizer: UIPanGestureRecognizer) { let translation: CGPoint = panGestureRecognizer.translation(in: panGestureRecognizer.view) var panOffset: CGFloat = translation.x @@ -136,7 +136,7 @@ public class BWSwipeViewHandler: NSObject, UIGestureRecognizerDelegate { } } - func didStartSwiping() { + public func didStartSwiping() { delegate?.swipeViewDidStartSwiping?(self) } @@ -181,7 +181,7 @@ public class BWSwipeViewHandler: NSObject, UIGestureRecognizerDelegate { // MARK: - Reset animations - func animateCellSpringRelease() { + public func animateCellSpringRelease() { UIView.animate(withDuration: self.animationDuration, delay: 0, options: .curveEaseOut, @@ -191,7 +191,7 @@ public class BWSwipeViewHandler: NSObject, UIGestureRecognizerDelegate { completion: self.releaseCompletionBlock) } - func animateCellSlidingDoor() { + public func animateCellSlidingDoor() { UIView.animate(withDuration: self.animationDuration, delay: 0, options: .allowUserInteraction, @@ -206,7 +206,7 @@ public class BWSwipeViewHandler: NSObject, UIGestureRecognizerDelegate { completion: self.releaseCompletionBlock) } - func animateCellSwipeThrough() { + public func animateCellSwipeThrough() { UIView.animate(withDuration: self.animationDuration, delay: 0, options: UIViewAnimationOptions.curveLinear, @@ -215,12 +215,15 @@ public class BWSwipeViewHandler: NSObject, UIGestureRecognizerDelegate { self.contentView.frame.origin.x = direction * (self.contentView.bounds.width + self.threshold) }, completion: self.releaseCompletionBlock) } - + +} + +extension SwipeViewHandler: UIGestureRecognizerDelegate { public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { if gestureRecognizer is UIPanGestureRecognizer && self.revealDirection != .none { let pan:UIPanGestureRecognizer = gestureRecognizer as! UIPanGestureRecognizer - let translation: CGPoint = pan.translation(in: contentView.superview) //TODO: superview reference may not be accurate + let translation: CGPoint = pan.translation(in: contentView.superview) return (fabs(translation.x) / fabs(translation.y) > 1) ? true : false } return false diff --git a/BWSwipeRevealCellExample/MasterViewController.swift b/BWSwipeRevealCellExample/MasterViewController.swift index ae32485..c426e80 100644 --- a/BWSwipeRevealCellExample/MasterViewController.swift +++ b/BWSwipeRevealCellExample/MasterViewController.swift @@ -10,7 +10,7 @@ import UIKit import CoreData import BWSwipeRevealCell -class MasterViewController: UITableViewController, NSFetchedResultsControllerDelegate, BWSwipeRevealCellDelegate { +class MasterViewController: UITableViewController, NSFetchedResultsControllerDelegate, SwipeRevealCellDelegate { var managedObjectContext: NSManagedObjectContext? = nil @@ -71,7 +71,7 @@ class MasterViewController: UITableViewController, NSFetchedResultsControllerDel func configureCell(_ cell: UITableViewCell, atIndexPath indexPath: IndexPath) { let object = self.fetchedResultsController.object(at: indexPath) - let swipeCell:BWSwipeRevealCell = cell as! BWSwipeRevealCell + let swipeCell:SwipeRevealCell = cell as! SwipeRevealCell swipeCell.bgViewLeftImage = UIImage(named:"Done")!.withRenderingMode(.alwaysTemplate) swipeCell.bgViewLeftColor = UIColor.green() @@ -79,7 +79,7 @@ class MasterViewController: UITableViewController, NSFetchedResultsControllerDel swipeCell.bgViewRightImage = UIImage(named:"Delete")!.withRenderingMode(.alwaysTemplate) swipeCell.bgViewRightColor = UIColor.red() - let type = BWSwipeCellType(rawValue: object.value(forKey: "type") as! Int)! + let type = InteractionType(rawValue: object.value(forKey: "type") as! Int)! swipeCell.swipeHandler.type = type switch type { @@ -159,7 +159,7 @@ class MasterViewController: UITableViewController, NSFetchedResultsControllerDel // MARK: - Reveal Cell Delegate - func swipeCellWillRelease(_ cell: BWSwipeCell) { + func swipeCellWillRelease(_ cell: SwipeCell) { print("Swipe Cell Will Release") if cell.swipeHandler.state != .normal && cell.swipeHandler.type != .slidingDoor { let indexPath: IndexPath = tableView.indexPath(for: cell)! @@ -167,13 +167,13 @@ class MasterViewController: UITableViewController, NSFetchedResultsControllerDel } } - func swipeCellActivatedAction(_ cell: BWSwipeCell, isActionLeft: Bool) { + func swipeCellActivatedAction(_ cell: SwipeCell, isActionLeft: Bool) { print("Swipe Cell Activated Action") let indexPath: IndexPath = tableView.indexPath(for: cell)! self.removeObjectAtIndexPath(indexPath) } - func swipeCellDidChangeState(_ cell: BWSwipeCell) { + func swipeCellDidChangeState(_ cell: SwipeCell) { print("Swipe Cell Did Change State") if cell.swipeHandler.state != .normal { print("-> Cell Passed Threshold") @@ -182,15 +182,15 @@ class MasterViewController: UITableViewController, NSFetchedResultsControllerDel } } - func swipeCellDidCompleteRelease(_ cell: BWSwipeCell) { + func swipeCellDidCompleteRelease(_ cell: SwipeCell) { print("Swipe Cell Did Complete Release") } - func swipeCellDidSwipe(_ cell: BWSwipeCell) { + func swipeCellDidSwipe(_ cell: SwipeCell) { print("Swipe Cell Did Swipe") } - func swipeCellDidStartSwiping(_ cell: BWSwipeCell) { + func swipeCellDidStartSwiping(_ cell: SwipeCell) { print("Swipe Cell Did Start Swiping") }