moritzsternemann / SwipyCell

Easy to use UITableViewCell implementing swiping to trigger actions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash in swipeColor function at the very beginning of swiping gesture

nadyapost opened this issue · comments

Crash occurs at the beginning of swipe gesture - when very slowly start dragging a cell to the right or to the left.

Screen Shot 2020-09-15 at 2 23 21 pm

Screen Shot 2020-09-15 at 2 15 43 pm

I got the same problem but discovered that it is this code from the example code which introduceg this crash:

cell.defaultColor = tableView.backgroundView?.backgroundColor

The example code should be updated.

In my case the defaultcolor becomes nil and since its being forceunwrapped in SwipyCell it will crash.

SwipyCell {
public var defaultColor: UIColor!
}

The fix is to make sure cell.defaultColor has a real value.