If I try to align views using HFlow(alignment: .firstTextbaseline) it does not align correctly:
Here's the code (in a Preview) and a comparison to HStack which does it correctly:
#Preview("HFlowTest") {
let testContent = Group {
Image(systemName: "lamp.desk")
Image(systemName: "lightbulb.led")
.font(.system(size: 100))
Image(systemName: "lightbulb.led")
}
.overlay(alignment: .centerFirstTextBaseline) {
Rectangle()
.frame(height: 1)
.foregroundStyle(.red)
}
VStack(alignment: .leading) {
Text("HStack:").font(.caption).foregroundStyle(.secondary)
HStack(alignment: .firstTextBaseline, spacing: 0) {
testContent
}
Text("HFlow:").font(.caption).foregroundStyle(.secondary)
HFlow(alignment: .firstTextBaseline, spacing: 0) {
testContent
}
}
}
If I try to align views using
HFlow(alignment: .firstTextbaseline)it does not align correctly:Here's the code (in a Preview) and a comparison to
HStackwhich does it correctly: