hoemoon
6/21/2018 - 11:17 AM

SelfSizingTextView

SelfSizingTextView

class SelfSizingTextView: UITextView {
  override var intrinsicContentSize: CGSize {
    let height = self.sizeThatFits(CGSize(
      width: self.bounds.width,
      height: CGFloat.greatestFiniteMagnitude)).height
    return CGSize(width: super.intrinsicContentSize.width, height: height)
  }
}