Im trying to implement "show more/show less" functionality to my UILabel in the tableView cell. I`ve tried searching the solution on the web, but they all seem to be outdated.
The caption text should have 2 lines and if its more than that it will expand to the full text
lazy var captionText: UILabel = {
let lbl = UILabel()
lbl.numberOfLines = 2
lbl.lineBreakMode = .byWordWrapping
return lbl
}()
func setupUI(viewModel: FeedModel) {
captionText.text = viewModel.postDescription
}
I`d love the final result look like this: