The simplest solution that worked for me was to put a height constraint on the textView in the Storyboard, then connect the textView and height constraint to the code:
@IBOutlet var myAwesomeTextView: UITextView!
@IBOutlet var myAwesomeTextViewHeight: NSLayoutConstraint!
Then after setting the text and paragraph styles, add this in viewDidAppear:
self.myAwesomeTextViewHeight.constant = self.myAwesomeTextView.contentSize.height
Some notes: