I have an issue with SwiftUI. When I use multiple VStacks inside another VStack, I have strange issues with text truncating.
Here is the smallest reproducible example:
The "B" label is truncated, but it should not be. If I change the "A" text or the "B" text, by adding or removing some letters, the "B" label is sometimes buggy, sometimes ok.
Here is the corresponding code:
struct ContentView: View {
var body: some View {
VStack {
VStack {
Text("AAAAAAAAAAAAAAAAAAAA")
}.background(Color.yellow)
VStack {
Text("BBBBBBBB")
Text("CCC")
}.background(Color.orange)
}.background(Color.blue)
}
}
Do I miss something or this is a bug of SwiftUI?
Thanks!
Environment: Xcode 11.4.1, iOS 13.4.1, Tested on Previews, Simulator & Devices
Edit: This behaves differently depending on the preview/simulator device you are using. For example, the above code, copy-pasted into a fresh project, is buggy on iPhone 11 Pro / 11 Pro Max and 8+. On iPhone 8 / 11 / SE 1&2, this works fine. So maybe it is related to some computational/rounding problems in the SwiftUI layout engine?

