Text.lineLimit() behavior is inconsistent in SwiftUI

I've experienced this.

For now if you wrap your views in a GeometryReader then it should respect the line limits

e.g.

GeometryReader { _ in
    VStack(alignment: .leading) {
       ...
    }
}

You might also be helped with this answer for the Xcode 11 GM:

https://stackoverflow.com/a/56604599/30602

The summary is that inside other Builders you need to add .fixedSize(horizontal: false, vertical: true) to your Text() to get it to wrap.

Tags:

Ios

Swift

Swiftui