SwiftUI truncates text for some letters

Viewed 174

I have create below view in SwiftUI. It works fine for some words but for some words of same length it truncates the text, Please see the image below. I am using Xcode 11.6

var body: some View {

    VStack {
        Text("John") //Problem with this line if I change text to "Aohn"/"aohn" it is truncating text.
            .font(.title)
            .padding([.leading,.trailing],10)
            .background(Color.yellow)
            .foregroundColor(Color.white)
            .cornerRadius(10)
            
        HStack {
             Text("Regular")
                .padding()
                .background(Color.gray)
                .foregroundColor(Color.white)
                .cornerRadius(10)
                
             Text("Medium")
                .padding()
                .background(Color.blue)
                .foregroundColor(Color.white)
                .cornerRadius(10)
        }
    }
   
}

enter image description here

1 Answers

Here is a fix - use fixed size. Tested with Xcode 11.4 / iOS 13.4

VStack {
    Text("aohn").fixedSize()    // << here !!
Related