In iOS 15 soft hyphens (\u{00AD}) are not considered when setting text on UILabel
. for example: The following code does render the text with the soft hyphen correctly in iOS 13 & 14, but not in iOS 15.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
label.text = "Very\u{00AD}VeryVeryVeryVeryVeryLongWordWithASoftHyphenTo"
}
}
How can i make UILabel consider the soft hyphen (\u{00AD}) in iOS 15?
Got response from Apple for this one:
Before iOS 15, we strictly followed soft hyphen, while in iOS 15 we now only consider those as hyphenation opportunities.
That is the design, and there are no plans to change it. The app should be able to use languageIdentifier attribute to influence the hyphenation with the attributed string so that it should follow German hyphenation even when system language is English.
So basically now we should use languageIdentifier attribute, lesser opportunities for our own custom hyphenation rules (like remove ugly, one side short, hyphenation break), but works grammatically correctly.
Soft hyphens still working but just as an addition.