iOS 8 introduced a way for tableViews to automatically adjust their cell\'s height based on their content (via AutoLayout).
// in viewDidLoad:
tableView.rowHeigh
Solution for Swift 4
func textViewDidChange(_ textView: UITextView) {
let fixedWidth = textView.frame.size.width
let oldSize = textView.frame.size
let newSize = textView.sizeThatFits(CGSize(width: fixedWidth, height: CGFloat(MAXFLOAT)))
if oldSize.height != newSize.height {
UIView.setAnimationsEnabled(false)
var newFrame = textView.frame
newFrame.size = CGSize(width: fmax(newSize.width, fixedWidth), height: newSize.height)
textView.frame = newFrame
self.tableView.beginUpdates()
self.tableView.endUpdates()
UIView.setAnimationsEnabled(true)
}
}