swiftui alignment code example
Example 1: center text swiftui
.multilineTextAlignment(.center)
Example 2: change individual element alignment swiftui
struct ContentView: View {
var body: some View {
HStack(alignment: .bottom) {
Image(systemName: "zzz")
.alignmentGuide(.bottom) { d in d[.bottom] + 8 }
Text("Sleep")
}
}
}