'TextField how to set width to hold certain number of characters

is it possible to set the width of SwiftUI TextField to hold a certain number of characters and display them without cutting them off? This way the width would adjust automatically based on font size.

The .frame(width/minWidth/maxWidth) is not really useful in this sense unless I would calculate the size of the characters.

Thanks for any ideas. Libor



Solution 1:[1]

I may have found a solution and that is TextField(....) .fixedSize(horizontal: true, vertical: true)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 matyasl