Text is truncated with certain font sizes on iOS 17+, but not on iOS 16

’m experiencing an issue where a Text view is unexpectedly truncated with certain font sizes (e.g., .body) on iOS 17 and later. This does not occur on iOS 16.

I’ve applied .fixedSize(horizontal: false, vertical: true) to allow the text to grow vertically, but it still doesn’t show the entire content. Depending on the text content or font size, it sometimes works, but not always.

How can I ensure the full text is displayed correctly on iOS 17+?

Here is a minimal reproducible SwiftUI example:

let sampleText1 = """
これはサンプルのテキストです、

・箇条書き1
・箇条書き2

であかさたなクロを送り、
アアを『ああああいいいい』フライパンに入れ、あかさたなです😋
"""

let sampleText2 = """
【旬|最高級】北海道産 生サンマ 釜飯
-----
Aaa iii uuu
"""

struct ContentView: View {
    var body: some View {
        ScrollView {
            VStack(alignment: .leading, spacing: 10) {
                HStack {
                    MessageTextView(text: sampleText1)
                        .layoutPriority(100)
                    Spacer()
                }
                HStack {
                    MessageTextView(text: sampleText2)
                        .layoutPriority(100)
                    Spacer()
                }
            }
        }
    }
}

struct MessageTextView: View {
    var text: String
    var body: some View {
        Text(text)
            .fixedSize(horizontal: false, vertical: true)
            .font(.body)
            .padding(.leading, 16)
            .padding(.trailing, 16)
            .padding(.top, 8)
            .padding(.bottom, 8)
    }
}
img1img2

Do you need those Spacer()s in the HStacks?

Thank you! You’re right — the Spacer()s themselves are not strictly necessary. However, I do need to apply trailing padding and align the text to the leading edge.

I tried removing the Spacer() and simplifying the layout, but the issue still reproduces with the following code:

HStack {
    MessageTextView(text: sampleText1)
        .layoutPriority(100)
        .padding(.trailing, 20)
        .frame(maxWidth: .infinity)
}

I’ve submitted feedback to Apple as well: FB17223576.

I’ve found a workaround that avoids the truncation issue on iOS 18 and later using the new textRenderer(_:) modifier. It ensures that all lines are rendered properly without truncation.

@available(iOS 17, *)
struct MyTextRenderer: TextRenderer {
    func draw(layout: Text.Layout, in ctx: inout GraphicsContext) {
        for line in layout {
            ctx.draw(line)
        }
    }
}

extension View {
    @ViewBuilder
    func avoidTextTruncationBug() -> some View {
        if #available(iOS 18, *) {
            textRenderer(MyTextRenderer())
        } else {
            self
        }
    }
}

struct MessageTextView: View {
    var text: String
    var body: some View {
        Text(text)
            .fixedSize(horizontal: false, vertical: true)
            .font(.body)
            .padding(.leading, 16)
            .padding(.trailing, 16)
            .padding(.top, 8)
            .padding(.bottom, 8)
            .avoidTextTruncationBug()
    }
}
Text is truncated with certain font sizes on iOS 17+, but not on iOS 16
 
 
Q