         (cell as? ToggleCell)?.delegate = self
         
         if let cell = cell as? TableModelCell {
-            modelDelegate?.configureCell(cell, with: item)
+            configureCell(cell, with: item)
         }
         
         return cell

import UIKit

public protocol TableModelDelegate: class {
    func cellStyle(forIdentifier identifier: String) -> TableModelCellStyle
    func configureCell(_ cell: TableModelCell, with item: Item)
    func handleEvent(_ event: UIControlEvents, with item: Item, sender: TableModelCell)
}

open class TableModelViewController: UITableViewController, TableModelDelegate {
    public var model: TableModel?
    public weak var modelDelegate: TableModelDelegate?
    
    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)

            let cell = tableView.cellForRow(at: indexPath) as? TableModelCell
        else { return }
        
        handleEvent(.primaryActionTriggered, with: item, sender: cell)
    }
}

extension TableModelViewController: ToggleCellDelegate {
    public func didChangeValue(sender: ToggleCell) {
        if let item = item(from: sender) {
            handleEvent(.valueChanged, with: item, sender: sender)
        }
    }
}
