DHExpandableLabel is a simple UILabel subclass that shows a tappable link if the content doesn't fit the specified number of lines. If touched, the label will expand to show the entire content.


let label = DHExpandableLabel(frame: rect)

let loremText = "Lorem Ipsum is dummy text of the print and typesetting industry. Lorem Ipsum has been thm Ipsum, Lorem Ipsum is simplyLorem Ipsum is simplyLorem Ipsum is simply"

label.numberOfLines = 2

label.shouldAddSpaceBetweenEllipsisAndMore = true

label.shouldTrimLeftSpace = true

label.delegate = self

label.shouldCollapse = true

label.originAttributedText = NSAttributedString(string: loremText, attributes: attributed)


Available in Cocoa Pods:

pod 'DHExpandableLabel'