Skip to content

Commit 41cb2cb

Browse files
authored
Test .firstTextBaseline and .lastTextBaseline (#93)
1 parent 5f814ad commit 41cb2cb

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Sources/Showcase/StackPlayground.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,38 @@ struct StackPlayground: View {
6565
Text("Text2 TA")
6666
}
6767
.border(Color.blue)
68+
Text("HStack firstTextBaseline (mixed sizes):").bold()
69+
HStack(alignment: .firstTextBaseline, spacing: 8) {
70+
Text("Big")
71+
.font(.title)
72+
Text("Small")
73+
.font(.footnote)
74+
.foregroundStyle(.secondary)
75+
}
76+
.padding(8)
77+
.border(Color.blue)
78+
Text("HStack firstTextBaseline (multi-line + single line):").bold()
79+
HStack(alignment: .firstTextBaseline, spacing: 8) {
80+
Text("Line one\nLine two\nLine three")
81+
.font(.body)
82+
.multilineTextAlignment(.leading)
83+
Text("Note")
84+
.font(.caption)
85+
.foregroundStyle(.secondary)
86+
}
87+
.padding(8)
88+
.border(Color.blue)
89+
Text("HStack lastTextBaseline (multi-line + single line):").bold()
90+
HStack(alignment: .lastTextBaseline, spacing: 8) {
91+
Text("Line one\nLine two\nLine three")
92+
.font(.body)
93+
.multilineTextAlignment(.leading)
94+
Text("Note")
95+
.font(.caption)
96+
.foregroundStyle(.secondary)
97+
}
98+
.padding(8)
99+
.border(Color.blue)
68100
Text("Text:").bold()
69101
HStack {
70102
Text("Long text that should receive the extra space from the short text when the width is divided")

0 commit comments

Comments
 (0)