I can't figure out how to align the content of this view:
I tried many different approaches:
- Fixed sized vstack
- setting max and min width
- setting the size of the images, etc.
Nothing seems to work :(
import SwiftUI
struct Welcome: View {
var body: some View {
VStack {
Text("Welcome to XXX")
.font(.title).bold()
HStack {
Image(systemName: "magnifyingglass")
.foregroundColor(Color(.systemOrange))
.imageScale(.large)
.padding()
VStack(alignment: .leading) {
Text("Lorem ipsum dolor")
.font(.headline)
Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore")
.font(.subheadline)
.foregroundColor(Color(.lightText))
}
}.padding()
HStack {
Image(systemName: "command")
.foregroundColor(Color(.systemOrange))
.imageScale(.large)
.padding()
VStack(alignment: .leading) {
Text("Lorem ipsum dolor")
.font(.headline)
Text("Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.")
.font(.subheadline)
.foregroundColor(Color(.lightText))
}
}.padding()
HStack {
Image(systemName: "cube")
.foregroundColor(Color(.systemOrange))
.imageScale(.large)
.padding()
VStack(alignment: .leading) {
Text("At vero eos et accusamus")
.font(.headline)
Text("At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque ")
.font(.subheadline)
.foregroundColor(Color(.lightText))
}
}.padding()
Button(action: {
print("skip")
}) {
HStack {
Spacer()
Text("Skip")
.font(.subheadline)
Spacer()
}
.foregroundColor(Color(.systemOrange))
}.padding(.top, 60)
Button(action: {
print("continue")
}) {
HStack {
Spacer()
Text("Sign In")
.font(.subheadline)
Spacer()
}
.padding(12)
.foregroundColor(Color(.label))
.background(Color(.systemOrange))
.cornerRadius(12)
}.padding()
}
}
}
It's quite annoying that the Human Interface Guidelines recommend creating welcome screens such as this and they don't provide a simple to do it.



