UITextView auto resizes to fit a UITableViewCell
You ever add a UITextView to one of your UITableViewCell’s? I have done it quite a few times due to some limitations of UILabel. But here is the problem: The UITextView is a UIScrollView. I had believed that it had no content size. Unlike UILabel which can determine its content size, the UITextView can not, or so I thought. The UITextView looks like it shouldn’t have a content size, but if you disable scrolling, it will resize when putting it in a UITableViewCell. I suppose when it has no scrolling, it is basically a UILabel in terms of functionality.
To prove this hypothesis, I have put together a small project to prove that this works.
https://github.com/wh1pch81n/TableViewtextViewExperiment.git
This actually surprised me because I thought I would have to use sizeThatfits(_: CGSize) in order to get the intended height and then add a height constraint to the UITextView.