iOS 15 - UIButtons checking themselves due to tableView.reloadData()

With the recent changes requiring builds to be done on xcode 13, we have run into a problem where on iOS 15 ONLY, UIButtons are checking themselves. In this particular situation, we have a button that, when "Yes" is clicked, a drop box appears below the question and indexes as such. Currently, the way this is written has tableView.reloadData() which allows the text box to appear. In iOS 14 and below, this causes no additional issues. In iOS15, when clicking the "Yes" or "No" button on the first question, the question directly below is also lights up. In other parts of the app, I could simply remove this for iOS15 and it worked just fine but due to the requirement for making the text box appear, this one wont allow for this.

See code here for the Reload

func didAnswerExpansionQuestion(itemKey: String, answer: Int) {
  var indexToAdjust = -1
   
  for (index, question) in questionsArray.enumerated() {
   if question["expansionItem"] != nil && question["expansionItem"] as! String == itemKey {
    indexToAdjust = index
     print (questionsArray.count)
   }
  }
   
  adjustCells(itemIndex: indexToAdjust, key: itemKey, answer: answer)
  cmhReferralTableView.reloadData()

Revisit the design of your data model. Does it represent the state of each question as in being answered or not answered in addition to the question being answered? So when the table view is reloaded it takes into the various states persisted in the data model as it renders the cell.

a drop box appears below the question

What is the dropbox on the screen shot ? Is it the "details" box ?

To tell more, it would be useful to see the cellForRowAt delegate func. Could you post it ?

@Claude31 - The dropdown that appears when clicking yes is the details box you see if the screenshot. Below is the cellForRowAt func you were asking for. Let me know if this provides any insights as I am lost entirely as this code has worked for a number of years now on iOS14 and below.

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   
  if indexPath.row >= 0 && indexPath.row < referralDestinations.count {

   let cell = tableView.dequeueReusableCell(withIdentifier: "MHReferralCell") as? MHReferralCell ?? MHReferralCell(style: .default, reuseIdentifier: "MHReferralCell")
   let org = referralDestinations[indexPath.row]
   cell.setOrganization(org: org, referral: consentResponses[org.id] ?? ConsentOffered.none, validating: validating)
   cell.backgroundColor = UIColor(rgb: 0x3B3F45)
   cell.delegate = self
   return cell
  }
  else if indexPath.row == referralDestinations.count {
   let cell = tableView.dequeueReusableCell(withIdentifier: "OptionsCell") as? OptionsCell ?? OptionsCell(style: .default, reuseIdentifier: "OptionsCell")
   cell.backgroundColor = UIColor(rgb: 0x3B3F45)
   cell.addBorders(edges: [.top], color: UIColor(rgb:0x51565E))
   cell.setOptions(optionsArray: ["No", "Yes"])
    
   return cell
  }
  else if indexPath.row == referralDestinations.count + questionsArray.count + 1 {
   let cell = tableView.dequeueReusableCell(withIdentifier: "NextCell") as? NextCell ?? NextCell(style: .default, reuseIdentifier: "NextCell")
   cell.nextDelegate = self.parent as! QuestionsViewController
   cell.currentSection = 4
   return cell
  }
  else {
   let question = questionsArray[indexPath.row - (referralDestinations.count + 1)]
   if question["type"] as! String != "question" {
    let cell = tableView.dequeueReusableCell(withIdentifier: "ExtraDetailsCell") as? ExtraDetailsCell ?? ExtraDetailsCell(style: .default, reuseIdentifier: "ExtraDetailsCell")
    cell.detailQuestionKey = question["type"] as? String
    cell.delegate = self.parent as! QuestionsViewController
    cell.scrollDelegate = self
    cell.set(text: delegate?.value(forQuestionKey: cell.detailQuestionKey!))
    return cell
   }
   else {
    let cell = tableView.dequeueReusableCell(withIdentifier: "QuestionCell") as? QuestionCell ?? QuestionCell(style: .default, reuseIdentifier: "QuestionCell")
    cell.set(questionInformation: question, qDeleate: self.parent as! QuestionsViewController, qcDelegate: self.parent as! QuestionsViewController, validating: validating, showDefinition: showQuestionDefinitions)
    cell.extraCellDelegate = self
    return cell
   }
  }
   
 }
iOS 15 - UIButtons checking themselves due to tableView.reloadData()
 
 
Q