ios swift uitableview

Get indexPath of UITextField in UITableViewCell with Swift

So, I’m building a Detail View Controller App that presents a Table with a two-part cell: the label and the Text Field.

I’m trying to retrieve the Text Field value and add it to an array.
I tried to use the “textField.superview.superview” technique but it didn’t worked.

func textFieldDidEndEditing(textField: UITextField!){
var cell: UITableViewCell = textField.superview.superview
var table: UITableView = cell.superview.superview
let textFieldIndexPath = table.indexPathForCell(cell)

Xcode fails to build and presents that “UIView is not convertible to UITableViewCell” and “to UITableView“.
The referring table has two sections, of four and two rows, respectively.

Thanks in advance.

added “.superview” at the second line of the function.