Hey guys I'm having some struggles when trying to understand how to edit certain section for a viewForFooterInSection
note the edit occurs when the user types something and this function gets call, that is already managed
override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return prepareFooterView(tableView: tableView, section: section)
}
the question is how can I access certain section for me to edit the title on it?
the function for footherview is:
func prepareFooterView(tableView: UITableView, section: Int) -> UIView?{
guard let tableView = tableView as? LightTableView else { return UIView() }
guard section <= TableSection.all.count else { return UIView() }
///the section is obtained here
let section = TableSection.all[section]
var title = ""
switch section {
case .detailsFooterView:
title = "card_details_section_footer".localized
case .nickname:
if nickname?.isValidNickName == false {
return prepareSpecificMessageInFooterView(with: "card_nickname_section_footer_error".localized, errorMessage: true)
}
title = "card_nickname_section_footer".localized
case .fastlink:
title = "earn_rewards_section_footer".localized
default:
title = ""
}
var footerView = tableView.standardFooterView(withTitle: title, textAlignment: .left, accessibilityIdentifier: section == .nickname || section == .fastlink || section == .detailsFooterView ? "NicknameFooterViewID" : nil, labelPadding: UIEdgeInsets(top: 12, left: 16, bottom: 0, right: -16))
return section == .nickname || section == .fastlink || section == .detailsFooterView ? footerView : nil
}
I would like to edit the case .fastlink: when a flag is turned ON
the section here:
num TableSection: Int {
case details
case detailsFooterView
case nickname
case fastlink
case scan
static var all: [TableSection] = isUs ? [.details, .detailsFooterView, .nickname, .fastlink] : [.details, .detailsFooterView, .nickname, .fastlink, .scan]
}
I guess this is not clear for me because this is running live instead of reloading the entire screen for example indexPath.row == 1