Open ghost opened 7 years ago
Hey, I also ran into a retain cycle issue while implementing MGSwipeTableCellDelegate in my project. After testing, I traced the retain cycle to the MGSwipeButton class convenience block callback which was retaining the cell responding the block.
I fixed the issue by adding [unowned self]
to the block parameter like below:
let undo = MGSwipeButton(title: "Undo", backgroundColor: .red, callback: { [unowned self] (_cell) -> Bool in //do something with _cell return true })
Not sure if this was faulty logic on my part or the block callback but it worked for me.
The view controller is being retained because of MGSwipe. Does anyone have the same problem: after one swipe, your view controller never goes to deinit? deinit { print ("deinit \(self)") } Please, can anyone help me? MGSwipeTableCellDelegate is declared as weak, which is good. But maybe something else? Tks!