UITextView that expands to text using auto layout
Summary: Disable scrolling of your text view, and don’t constraint its height. To do this programmatically, put the following code in viewDidLoad: let textView = UITextView(frame: .zero, textContainer: nil) textView.backgroundColor = .yellow // visual debugging textView.isScrollEnabled = false // causes expanding height view.addSubview(textView) // Auto Layout textView.translatesAutoresizingMaskIntoConstraints = false let safeArea = view.safeAreaLayoutGuide NSLayoutConstraint.activate([ textView.topAnchor.constraint(equalTo: … Read more