title: How to call a function on toggle of switch in a custom cell - TableViewCell Swift
body: <p>I have a switch button in a custom cell that is inserted into the tableView. How can I update the tableview on toggle of the switch button ?</p>
  
  <p>Below is the function where I am inserting the custom tableViewCell that contains the toggleSwitch</p>
  
  <pre><code>override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          
    let cell = Bundle.main.loadNibNamed("AvailabilityTableViewCell", owner: self, options: nil)?.first as! AvailabilityTableViewCell
              
    // Configure the cell...
    cell.availabilityLabel.text = "Available"
    switchIsOn = cell.availabilitySwitch.isOn
    return cell
              
   }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/hjRwa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hjRwa.jpg" alt="enter image description here"></a></p>