How can I add hyphenation to a SwiftUI Text? Currently SwiftUI makes a paragraph when there is no space, but this makes everything hard to read and messy.

I have done a bit of research and it seems that there is no native method. Is there another way to achieve this?
A possible approach is to add explicitly "soft hyphen" unicode symbols in places where you want hyphenation.
Here is a demo. Prepared with Xcode 12.4 / iOS 14.4
Case 1: enough space
Text("Minded\u{AD}ness")
.frame(width: 180) // << wide frame
.border(Color.black)

Case 2: limited space
Text("Minded\u{AD}ness")
.frame(width: 80) // << limited frame
.border(Color.black)

Note: Preview does not understand such unicode symbols, so test on Simulator or real device
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With