For expanding label in UICollectionViewCell, I am using this library
My code is as below:
label.delegate = self
label.shouldCollapse = true
label.numberOfLines = 4
label.collapsed = true
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let size: CGSize = "Modern Furniture reflects the design ilosophy of form following function prevalent in modernism. These designs represent the ideals of cutting excess, practicality and an absence of decoration.".size(withAttributes: [NSAttributedString.Key.font: UIFont.font_light(14)])
return CGSize(width: collectionView.frame.size.width , height: size.height + 390)
}
This thing works for UITableViewCell but it isn't working for UICollectionViewCell. In fact, the labels delegate methods are also not called.