Q:

How to change data in cell in dynamic UITableView xcode project?

I have a Dynamic Prototypes Table view that has different cells, I'm adding the cells to the table view and I want to change their content. All the tutorials I find is for a tableview with only one type of cell, but I have 8 different types. How would I change their content (ie, textfields etc) and how would I get actions from them back to the main tableview controller to do some business logic? (ie button pressed etc)
What I did is:

I created a costume class for each cell type and connected them under customClass, class field.

I attached the textfields etc, actions and references to these classes.
this is my cellAtRow function I assume I would change it in this function somehow?
or reference the classes from here? 
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    print ("indexPath: ", indexPath)
    print ("indexPath: ", indexPath[0])
    print ("-------")

    if (sectionsData[indexPath[0]] == "header") {
        let cell = tableView.dequeueReusableCell(withIdentifier: "headerCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "description") {
        let cell = tableView.dequeueReusableCell(withIdentifier: "headerInfoCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "diagnoses") {
        let cell = tableView.dequeueReusableCell(withIdentifier: "diagnosisCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "perscription") {
        let cell = tableView.dequeueReusableCell(withIdentifier: "perscriptionCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "notes") {
        let cell = tableView.dequeueReusableCell(withIdentifier: "notesCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "addFaxHeadline") {

        let cell = tableView.dequeueReusableCell(withIdentifier: "addFaxCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "addFax") {

        let cell = tableView.dequeueReusableCell(withIdentifier: "emailNameCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "addEmailHeadline") {

        let cell = tableView.dequeueReusableCell(withIdentifier: "addEmailCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "addEmails") {

        let cell = tableView.dequeueReusableCell(withIdentifier: "emailNameCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "givePermissionHeadline") {

        let cell = tableView.dequeueReusableCell(withIdentifier: "permissionCell", for: indexPath)

        return cell

    } else if (sectionsData[indexPath[0]] == "select answer") {

        let cell = tableView.dequeueReusableCell(withIdentifier: "selectAnswerCell", for: indexPath)

        return cell
    }

A:

You need to use 
let cell = tableView.dequeueReusableCell(withIdentifier: "headerCell", for: indexPath) as! HeaderTableViewCell

to call cell.yourTextField.text for example

A:

You have to cast your cells to the class they belong. On the second line of the code block you can see an example of this.
if (sectionsData[indexPath[0]] == "header") {
    let cell = tableView.dequeueReusableCell(withIdentifier: "headerCell", for: indexPath) as! HeaderTableViewCell

    cell.titleLbl.text = "Title"
    cell.delegate = self // To receive actions back

    return cell
}

. . . // More of the same

// default return

To send calls back to your main view controller you can add protocols to your cells like so:
protocol HeadTableViewCellProcol{
    func bttnPressed()
}

class HeadTableViewCell: UITableViewCell{

    var delegate: HeadTableViewCellProcol?

    @IBAction func bttnPressedInCell(){
        delegate?.bttnPressed()
    }
}

The this of this protocols like the protocols you had to implement for your UITableView. You will also have to implement these protocols in your main VC.

