title: shrinking multiline text with maximal width in SwiftUI
body: <p>Having a text that is maximum a specified width, and if the text is shorter takes up not more space is easy enough. It can be done using:</p>
  <pre class="lang-swift prettyprint-override"><code>Text(&quot;Short text&quot;)
              .frame(maxWidth: UIScreen.main.bounds.width * 0.6)
              .fixedSize(horizontal: true, vertical: false)
              .lineLimit(nil)
              .border(Color.blue)
  </code></pre>
  <p>resulting in:
  <a href="https://i.stack.imgur.com/UeLee.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UeLee.png" alt="screenshot" /></a>
  The problem here is that if the text is too long, it will not become multiline, but it gets truncated. This could be fixed by removing the fixedSize modifier, but then the text frame no longer shrinks when the text is less wide than the maximal width. like so:
  <a href="https://i.stack.imgur.com/YTbn5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YTbn5.png" alt="second_screenshot" /></a></p>
  <p>How can I get the <strong>shrinking</strong> AND the <strong>multiline capability if the text is too long for the maximal width</strong>?</p>