MortimerGoro / MGSwipeTableCell

An easy to use UITableViewCell subclass that allows to display swippable buttons with a variety of transitions.
MIT License
6.97k stars 1.08k forks source link

swipeButtonsForDirection detects both directions when swiping from right to left #328

Open onthecodepath opened 5 years ago

onthecodepath commented 5 years ago

Hi,

I'm encountering what I suspect to be a bug where I implement logic in the swipeButtonsForDirection delegate method and it detects both directions were swiped when I only swiped from right to left.

Example code below:

@objc func swipeTableCell(_ cell: MGSwipeTableCell!, swipeButtonsForDirection direction: MGSwipeDirection, swipeSettings: MGSwipeSettings!, expansionSettings: MGSwipeExpansionSettings!) -> [Any]! {
    if direction == .leftToRight {
        print("User swiped left to right")
        return nil
    } else if direction == .rightToLeft {
        print("User swiped right to left")
        return nil
    } else {
        return nil
    }
}

Swiping from right to left results in the below getting printed to the console: "User swiped left to right" "User swiped right to left"

I should only expect the console to print "User swiped right to left".

Is anyone else running into the same issue? You can also just breakpoint and detect that direction is equal to both directions when you swipe from right to left