So I am trying to build a little expand and collapse UILabel like the one you see below. There would also be some text below it. When you touch the heading it should show you more less of the text.
I understand that I can set the number of lines to zero of the text label and it will figure out how much height it needs to show the whole text. My initial approach was change the number of lines from zero to say three, and then I do something like the code below...
`UIView.animate(withDuration: 0.4) {
self.body.superview?.layoutIfNeeded()
}`
this technically works, but the animation looks terrible. It looks jumpy for the lack of better word, so I am think I might have to animate the height instead. So how can I actually calculate the needed height of the text if I don't know how long it will? I can animate the height from say 65 (some arbitrary number) to whatever the height it needs to be.