Hello!
As you see I add additional UIStackView that embraces UITextView.
I added listeners for textViewDidChange and call all setNeedsUpdateConstraints, setNeedsLayout and other layout methods on both self ( ContentView ) and self.superview ( CustomConfigurationCell ).
Description
I have a ContentView which contains UITextView. I would like to use this ContentView in UICollectionViewCell.View Hierarchy
Code Block UICollectionView { MyContentView { UIStackView { UITextView } } }
As you see I add additional UIStackView that embraces UITextView.
Problem
When I typing in UITextView, it doesn't grow at all. But if I press on cell and apply configuration is applied to content view, everything works fine and I get correct size of textView.Code
Code Block class CustomConfigurationCell: UICollectionViewCell { override func updateConfiguration(using state: UICellConfigurationState) { super.updateConfiguration(using: state) backgroundConfiguration = CustomBackgroundConfiguration.configuration(for: state) } } class MyContentView { private var appliedConfiguration: CustomContentConfiguration! private func apply(configuration: CustomContentConfiguration) { guard appliedConfiguration != configuration else { return } appliedConfiguration = configuration } }
What have I tried so far?
I added listeners for textViewDidChange and call all setNeedsUpdateConstraints, setNeedsLayout and other layout methods on both self ( ContentView ) and self.superview ( CustomConfigurationCell ).