top
A guide that marks the top edge of the view.
Declaration
static let top: VerticalAlignmentMentioned in
Discussion
Use this guide to align the top edges of views:
[Image]
The following code generates the image above using an HStack:
struct VerticalAlignmentTop: View {
var body: some View {
HStack(alignment: .top, spacing: 0) {
Color.red.frame(height: 1)
Text("Top").font(.title).border(.gray)
Color.red.frame(height: 1)
}
}
}