I'm facing the following problem with SwiftUI Text: In the following example SwiftUI breaks the word "Amazement" into "amazeme" on the first line and "nt" on the second. How to avoid it, isn't it a bug?
I want the word "amazement" to be written on one line. Is there any modifier that can allow this (don't divide words or something)?
Tried .allowsTightening, .fixedSize. Changed the order of modifiers, Didn't help.
Is it a bug or we currently don't have an option to fix this? The solution should work for every String, not only for the mentioned string.
You can replicate the behaviour using this code:
struct TestView2: View {
var body: some View {
ZStack {
Text("Amazement Awaits us at every corner")
.font(.system(size: 160))
.foregroundColor(.blue)
.foregroundColor(.white)
.lineLimit(4)
.multilineTextAlignment(.leading)
.minimumScaleFactor(0.01)
//.allowsTightening(true)
//.fixedSize(horizontal: false, vertical: true)
}
}
}
struct TestView2_Previews: PreviewProvider {
static var previews: some View {
TestView2()
}
}