[ad_1]
I have been having bother determining a strategy to ship the TableView part the place my button is situated into one other file, the place my motion handler is situated. My button is within the first header part of my tableview. Extra particularly, I am unsure tips on how to retailer the part and ship it to different information the place I can use it to set off sure actions for less than the button in my SectionHeaderView. Would I must create a operate/delegate and go within the part and listen to? Beneath are the information I am utilizing for this.
TableView file
func tableView(_ tableView: UITableView, viewForHeaderInSection part: Int) -> UIView? {
guard let vM = suggestionSections[safeIndex: section] else { return nil }
let header = SectionHeaderView(body: .zero)
header.configure(vM)
header.delegate = delegate
if part == 0 { // the place my button is situated (i've two headers)
// need to ship the part to SectionHeaderView file the place I've my motion func for when the button is tapped...
// ... or to different information the place I've delegates
}
return header
}
SectionHeaderView file
lazy var button = UIButton()
[ad_2]
