SwiftUI multi-line text view

Job ID: 37145639

Budget: $10 – $30 CAD

I require a SwiftUI view that will display text, with a fixed height (number of lines) and a variable width.

The view should layout text so that it wraps onto available lines (at natural breaks, e.g. spaces, commas, hyphens, etc.) before growing in width.

In other words, given a fixed height (in number of lines) what is the smallest width I need to display all of the text (without breaking words "mid word").

For example, the text "This is an example string" with in input lines=2 would render as

This is an
example string

With an input of lines=3, it would render as

This is an
example
string

I should be able to apply usual modifiers (e.g. ".font") and I should be able to align the text within the view (leading, center, trailing)

The view must work as a child within scrollable HStacks and in HFlow layouts (see https://github.com/globulus/swiftui-flow-layout)

To weed out bots, please start your response with the text "Hi, I am not a bot and have read and understood your project" - all proposals that don't start with this will be immediately rejected.
Related categories: Swift iOS Development