SwipeableView
A view with swipe functionality that is used as action buttons view for channel list item view.
open class SwipeableView: _View, ComponentsProvider, UIGestureRecognizerDelegate
Inheritance
_View
, ComponentsProvider
, UIGestureRecognizerDelegate
Properties
panGestureRecognizer
Gesture recognizer which is needed to be added on the owning view which will be recognizing the swipes.
open private(set) lazy var panGestureRecognizer: UIPanGestureRecognizer
isOpen
Returns whether the swipe action items are expanded or shrunk.
open var isOpen: Bool
minimumSwipingVelocity
Minimum swiping velocity needed to fully expand or shrink action items when swiping.
open var minimumSwipingVelocity: CGFloat = 30
contentTrailingAnchor
Constraint the trailing anchor of your content to this anchor in order to move it with the swipe gesture.
public var contentTrailingAnchor: NSLayoutXAxisAnchor
When the swipe view is closed, this anchor matches the trailing anchor of the swipe view. When the view is open, this anchor matches the leading anchor of the first button.
actionStackViewWidthConstraint
Constraint constant should be reset when view is being reused inside UICollectionViewCell
.
public var actionStackViewWidthConstraint: NSLayoutConstraint?
delegate
SwipeableViewDelegate
instance
public weak var delegate: SwipeableViewDelegate?
indexPath
The provider of cell index path. The IndexPath is used in here to pass some reference
for the given cell in action buttons closure. We use this in delegate function
calls swipeableViewActionViews(forIndexPath)
and swipeableViewWillShowActionViews(forIndexPath)
public var indexPath: (() -> IndexPath?)?
actionItemsStackView
The UIStackView
that arranges buttons revealed by swipe gesture.
open private(set) lazy var actionItemsStackView: UIStackView = UIStackView()
.withoutAutoresizingMaskConstraints
Methods
setUp()
override open func setUp()
setUpLayout()
override open func setUpLayout()
handlePan(_:)
@objc open func handlePan(_ gesture: UIPanGestureRecognizer)
gestureRecognizerShouldBegin(_:)
override public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool
gestureRecognizer(_:shouldBeRequiredToFailBy:)
public func gestureRecognizer(
_ gestureRecognizer: UIGestureRecognizer,
shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer
) -> Bool
gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:)
public func gestureRecognizer(
_ gestureRecognizer: UIGestureRecognizer,
shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer
) -> Bool
close()
Closes the stackView
with buttons.
public func close()