title: Swift sender.setTitle code didn't visible?
body: <p>I have question about sender title. I have a button and I want to change title according to some condition. In this point I made sender.setTitle() code but title appear only  like 0.5 second. Its not visible let me say more clear. How can I solve it? 
  Here my code: </p>
  
  <pre><code>    @objc func handleExpandCloseForAlim(sender: UIButton) {
  
  
      if (sender.tag == 1) {
          if keys[0] == 0 {
              sender.setTitle("titlesample", for: .normal)
              keys[0] = 1
          }else{
              keys[0] = 0
              sender.setTitle("titlesampleclose", for: .normal)
          }
          DispatchQueue.main.async {
              self.tableView.reloadData()
          }
  
      }
  </code></pre>
  
  <p>Here my header view code:</p>
  
  <pre><code>            let headerView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 100))
          // code for adding centered title
          headerView.backgroundColor = .lightGray
          let headerLabel = UILabel(frame: CGRect(x: 0, y: 10, width: tableView.bounds.size.width, height: 28))
          headerLabel.textColor = UIColor.black
          headerLabel.text = "   Teslim Alınacağı Adres"
          headerLabel.font = UIFont.boldSystemFont(ofSize: 14)
          headerLabel.textAlignment = .left
          headerView.addSubview(headerLabel)
  
          // code for adding button to right corner of section header
          let button: UIButton = UIButton(frame: CGRect(x:headerView.frame.size.width - 100, y:8, width:100, height:28))
          button.setTitleColor(.black, for: .normal)
          button.titleLabel!.font = UIFont.boldSystemFont(ofSize: 14)
          button.layer.cornerRadius = 4
          button.tag = 1
          button.backgroundColor = UIColor.blue
          button.addTarget(self, action: #selector(handleExpandCloseForAlim(sender:)), for: .touchUpInside)
  
          headerView.addSubview(button)
          return headerView
  </code></pre>