Modify text in SwiftUI

Viewed 1797

If I changed the content of Text in SwiftUI, the text got stretch/truncated.

For example, let's say we changed the Text from "World" to "SwiftUI", we got the result as shown. How do we prevent this to happened?

Text got stretched in SwiftUI

1 Answers

Your code is working fine, it's probably a bug when you're previewing the app. If you actually run the app on a simulator you will see the text updating correctly. Hopefully it will be fixed in the next Xcode 11 beta releases.


Update: This issue was fixed with Xcode 11 beta 2.

Related