I am making a swiftUI calendar and met a weird truncation problem of SwiftUI Text View.
struct test : View {
var body: some View {
GeometryReader { geometry in
HStack(alignment: .center, spacing: 0) {
ForEach(0..<7) { _ in
Text("Tue").frame(width: geometry.size.width / 7).border(Color.red, width: 2)
}
}
}
}
}
In the beginning, I thought it might be because the Text View size is not big enough. But when I decrease the Text View Width, the truncation is gone. I also tried to set a smaller font and it didn't work too. Thanks for any hint!
struct test : View {
var body: some View {
GeometryReader { geometry in
HStack(alignment: .center, spacing: 0) {
ForEach(0..<7) { _ in
Text("Tue").frame(width: geometry.size.width / 8).border(Color.red, width: 2)
}
}
}
}
}