I'm making a custom cell from XIB file and implementing in my tableView,
I am able to implement the text from the custom cell but how can I implement the same for the button and receive touches on it ?
Here is the code I wrote:
struct cellData {
let cell : Int!
let text : String!
let button =  UIButton()
}
var arrayOfData = [cellData]()
override func viewDidLoad() {
    super.viewDidLoad()
arrayOfData = [cellData(cell : 1, text: "ahfhasdf", button: button)]
 }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    if arrayOfData[indexPath.row].cell==1{
        let cell=Bundle.main.loadNibNamed("CustomTableViewCell1", owner: self, options: nil)?.first as! CustomTableViewCell1
        cell.label1.text=arrayOfData[indexPath.row].text
        cell.pillImage.currentImage=arrayOfData[indexPath].pillImage
        return cell
}
My pill is the button in CustomTableViewCell1 which I want in my cell and how to have actions when the button is pressed ? Please help.