In my main page, I created a xib file for UITableViewCell. I\'m loading the cell from that xib file and its working fine.
Inside of the cell I have some labels and
All patterns above are fine. my two cents, in case You add by code (for example multiple different cells and so on..) there is a FAR simple solution.
As buttons allow to specify a "target" You can pass directly the controller AND action to cell/button when setting it.
In controller:
let selector = #selector(self.myBtnAction)
setupCellWith(target: self, selector: selector)
...
in custom cell with button:
final func setupCellWith(target: Any? selector: Selector){
btn.addTarget(target,
action: selector,
for: .touchUpInside)
}