Strings truncate issue on Text method

I have one issue with the String truncate on the Bulls eye project. Can someone help me out with it.

Here is the code I had written, in the Preview mode it is showing properly, but wile at the time of rendering on the Simulator it’s getting truncated at the last.

Simulator Screen Shot - iPhone 11 Pro - 2020-02-04 at 21.36.55

Above is the screenshot of the application on Simulator, below is the code.

    struct ContentView: View {
    @State var alertIsVisible: Bool = false
    var body: some View {
        VStack {
            HStack(alignment: .center, spacing: 16) {
                Text("Put the bulls eye as close you can to:")
            .frame(minWidth: 500, maxWidth: .infinity, alignment: .center)
            //                Slider Row
                Slider(value: .constant(50))
            //                Button Row
            Button(action: {
                self.alertIsVisible = true
            }) {
                Text("Hit Me!")
            .alert(isPresented: $alertIsVisible){ () ->
                Alert in
                return Alert(title: Text("Hello There"), message: Text("This is my pop-up"), dismissButton: .default(Text("Awesome")))

Hi @sunil-kumar,
instead of adding a frame to the text, simply use the .fixedSize() modifier


This topic was automatically closed after 166 days. New replies are no longer allowed.