UILabel repeated text when limit number of lines with truncating and break line - iOS 15.4

Hi, I noticed a bug on UILabel only on iOS 15.4. If we have a UILabel with numberOfLines = 3 using byTruncatingHead and the text contains a \n, the last line replicates some characters from the previous line. Please take a look at the attached screenshot.

The code is very simple:

        var text = "A Person Name\nalso commented on Other Person\'s post: Hi Eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
        label.text = text
        label.numberOfLines = 3
        label.lineBreakMode = .byTruncatingHead

Note: UILabel has 32 horizontal margin constraints and I tested it on iPhone 12. I tested it on iPhone 11 running iOS 15.3 and it works fine.

Regards, Rodrigo Busata

UILabel repeated text when limit number of lines with truncating and break line - iOS 15.4
 
 
Q