How can I center text below my labels and icons? Every time I add text below each label the labels and icons are shifted. What am I missing?
For example:
Text("sub title text")
.foregroundColor(Color(.systemGray))
.multilineTextAlignment(.center)
.padding()
The code above I am trying to insert shifts the labels and icons in the wrong direction. I would like to center the inputed text below each label and icon.
struct ContentView: View {
var body: some View {
VStack {
Text("My Title")
.font(.system(.title))
.fontWeight(.bold)
.padding()
// MARK: LABELS
VStack (alignment: .leading) {
Label {
Text("Design")
.font(.title)
.foregroundColor(Color(.systemGray))
.labelStyle(.titleAndIcon)
.padding()
} icon: {
Image(systemName: true ? "pencil.circle" : "pencil.circle")
.foregroundColor(Color(.systemBlue))
.font(.title)
.multilineTextAlignment(.center)
}
// Text("sub title text")
// .foregroundColor(Color(.systemGray))
// .multilineTextAlignment(.center)
// .padding()
Label {
Text("Develop")
.font(.title)
.foregroundColor(Color(.systemGray))
.labelStyle(.titleAndIcon)
.padding()
} icon: {
Image(systemName: true ? "qrcode" : "qrcode")
.foregroundColor(Color(.systemBlue))
.font(.title)
}
Label {
Text("Launch")
.font(.title)
.foregroundColor(Color(.systemGray))
.labelStyle(.titleAndIcon)
.padding()
} icon: {
Image(systemName: true ? "cart.circle" : "cart")
.foregroundColor(Color(.systemBlue))
.font(.title)
//.imageScale(.large)
}
}//END Label VSTACK
}
.padding()
}//END VSTACK
}

The best you can do is not using Label at all, instead, use HStack.
Try this code instead:
Edit: I improved the code above to not repeat any iteration, hope it helps!