How to give text field change event for text filed on uitableview in swift?

I have a UITableView on each row it has a text field. When user type something on text field i want to trigger that textFieldDidChange or whatever. Basically when text field change i wanna calculate something how can i do that?I’m using swift.

Here is part of my code:

func numberOfSections(in tableView: UITableView) -> Int {

    return 1
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

    if(tableView == self.seatsDropDownTblView){
        return seatsList!.count
    }else{
        return priceList!.count
    }

}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {


    if tableView == self.seatsDropDownTblView {
        let seats_cell = tableView.dequeueReusableCell(withIdentifier: "SeatsCell", for: indexPath) as! SeatsCell
        seats_cell.seatsCountLbl.text = self.seatsList?[indexPath.row]
        seats_cell.selectionStyle = .none
        return seats_cell

    }else {
        let price_cell = tableView.dequeueReusableCell(withIdentifier: "AddPriceCell", for: indexPath) as! AddPriceCell
        price_cell.txtPrice.text = priceList?[indexPath.row].Price
        price_cell.dropOffPointLbl.text = priceList?[indexPath.row].DropPoint

        self.indexPathArray.append(indexPath as NSIndexPath)
        price_cell.txtPrice.tag = indexPath.row
        //Delegates
        price_cell.txtPrice.delegate = self
        //Assign Delegates
        price_cell.txtPrice.delegate = self
        price_cell.selectionStyle = .none
        return price_cell

    }


}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

    if tableView == self.seatsDropDownTblView {
        //let seats_cell = tableView.dequeueReusableCell(withIdentifier: "SeatsCell", for: indexPath) as! SeatsCell
        //seats_cell.selectionStyle = .none

        self.selectedSeat = (self.seatsList?[indexPath.row])!
        self.selectedSeatLbl.text = self.selectedSeat

        self.seatsDropDownView.isHidden = true
        isDropDownFalls = true
        self.dropDownBtnImg.image = UIImage(named:"drop_down")

    }else {
        let cell = tableView.cellForRow(at: indexPath) as! AddPriceCell
        cell.selectionStyle = .none

    }
}
func textFieldDidChange(_ textField: UITextField) {
    NSLog("Event Triggered")
}

This delegate is not triggered . I have import the UITextFieldDelegate protocol as well. Any suggestion?

You have to distinguish between action and delegate methods. The correct signatire of the delegate method is textField(_:, shouldChangeCharactersIn range:, replacementString:). So you have to implement it as:

func textField(_ textField: UITextField, 
    shouldChangeCharactersIn range: NSRange, 
    replacementString string: String) -> Bool {

    NSLog("Event Triggered")
    return true
}

You can use your method textFieldDidChange(_:) as action method. To register it use:

price_cell.txtPrice.addTarget(self, 
    action: #selector(textFieldDidChange(_:)), 
    for: .valueChanged)

There is no method as textFieldDidChange for UITextField in UITextFieldDelegate. Thats why it is not getting called for you. You need to implement one of the methods available in UITextFieldDelegate.

I guess textFieldDidEndEditing is what you might want to implement.
To check all the methods in UITextFieldDelegate, command + click on UITextFieldDelegate in XCode.