I’ve a easy SwiftUI display and I am making an attempt to get the buttons within the backside to be horizontally centered. After I was typing within the textual content within the prime part, the title textual content above it centered mechanically, which is nice. Looks as if there ought to be a easy strategy to heart the entire gadgets within the backside part with out having to make use of a protracted textual content string.
This is the code:
import SwiftUI
struct Testing : View
{
func abc(){}
func def(){}
func xyz(){}
var physique: some View
{
Type
{
Part
{
VStack
{
Textual content("Title")
.font(.largeTitle)
Textual content("And extra textual content right here. And the extra textual content I am including, I see the title above centering mechanically. Okay. Good.")
}
}
Part
{
VStack
{
Textual content("TODO: Middle!")
Button("Abc", motion: abc).buttonStyle(.borderedProminent)
Button("Def", motion: def).buttonStyle(.borderedProminent)
Button("Xyz", motion: xyz).buttonStyle(.borderedProminent)
}
}
} // Type
}
}
#Preview {
Testing()
}


