2

How can I tell SwiftUI that when text wraps, I'd like all the lines to be as close to equal length as possible?

For example, I don't want this:

The quick brown fox jumps over the
lazy dog

Even if there is enough horizontal space to fit everything except "lazy dog" on the first line, I want this instead (or whatever gives the most equal line lengths for the font in use):

The quick brown fox
jumps over the lazy dog
Edward Brey
  • 40,302
  • 20
  • 199
  • 253
  • Can it be limited to 2 lines? Or does it need to dynamically adjust how many lines? – aheze May 01 '21 at 23:08
  • @aheze A general solution for as many lines as the text requires would be best, but a partial solution for text known to fit into 2 lines would still be useful. – Edward Brey May 02 '21 at 01:57

0 Answers0