         tableView.estimatedRowHeight = 44
     }
     
+    // MARK: - UITextVeiew Delegate
+    
+    func textViewDidChange(textView: UITextView) {
+        if let row = indexPathForCellContainingTextView(textView)?.row{
+            let newHeight = textView.frame.height
+            resizeCellHeight(newHeight, forCellAtRow: row)
+            tableViewDataSource.tableData[row].height = newHeight
+        }
+    }
+    
+//    func textViewDidBeginEditing(textView: UITextView) {
+//        currentlyActiveTextView = textView
+//        if let indexPath = indexPathForCellContainingTextView(textView){
+//            modules[indexPath.row].isEditing = true
+//            currentEditingIndexPath = indexPath
+//            let rect = tableView.rectForRowAtIndexPath(indexPath)
+//            tableView.scrollRectToVisible(rect, animated: true)
+//            
+//            //tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: UITableViewScrollPosition.Bottom, animated: true)
+//            
+//        }
+//        
+//    }
+//    
+//    func textViewDidEndEditing(textView: UITextView) {
+//        if let index = indexPathForCellContainingTextView(textView)?.row{
+//            modules[index].contentText = textView.text
+//            modules[index].isEditing = false
+//        }
+//        currentlyActiveTextView = nil
+//        currentEditingIndexPath = nil
+//    }
+    
+    func indexPathForCellContainingTextView(textView: UITextView) -> NSIndexPath? {
+        let location = tableView.convertPoint(textView.center, fromView: textView)
+        return tableView.indexPathForRowAtPoint(location)
+    }
+    
+    
+    func resizeCellHeight(height: CGFloat, forCellAtRow row: Int) {
+        let indexPath = NSIndexPath(forRow: row, inSection: 0)
+        tableView.beginUpdates()
+        let cell = tableView.cellForRowAtIndexPath(indexPath) as TextModuleTableViewCell
+        cell.frame.size.height = height
+        tableViewDataSource?.tableData[indexPath.row].height = height
+        tableView.endUpdates()
+    }
+    
     // MARK: - ModuleSelectorViewController Delegate
     
-    func moduleSelectorViewController(moduleSelectorViewController: ModuleSelectorViewController, didtSelectModule module: ComposerModule) {
+    func moduleSelectorViewController(moduleSelectorViewController: ModuleSelectorViewController, didSelectModule module: ComposerModule) {
         
         switch module.type{
             

    }
}

class ComposerViewController: UIViewController, ModuleSelectorViewControllerDelegate {

    @IBOutlet var tableView: UITableView!
    var tableViewDataSource: ComposerTableViewDataSource?
    var tableViewDelegate: ComposerTableViewDelegate?

    override func viewDidLoad() {
        super.viewDidLoad()

            println()
        }
        
        tableViewDataSource.tableData.append(module)
        tableView.reloadData()
        moduleSelectorViewController.dismissViewControllerAnimated(true, completion: nil)
    }
    
