I am coding a SwiftUI view file that prompts the user to enter their date of birth. After all fields have been appropriately entered a navigation button appears to navigate to the next step. My only problem is when the button appears it shifts all the text included in the HStack to the left. How do I add the button without shifting the text? I tried making a separate file for the button and called that file instead but it made all the text disappear.
I tried using spacers, it makes the text shift less but I don't want it to shift at all.
(I am very new to Swift any help is greatly appreciated)
HStack {
Spacer(minLength: 50)
Spacer(minLength:10)
VStack(alignment: .leading) {
Text("Enter")
.font(Font.custom("Staatliches-Regular", size: 30))
.foregroundColor(Color.white)
.kerning(7.2)
Text("Your")
.font(Font.custom("Staatliches-Regular", size: 30))
.foregroundColor(Color.white)
.kerning(7.2)
Text("Birthday")
.font(Font.custom("Staatliches-Regular", size: 30))
.foregroundColor(Color.white)
.kerning(7.2)
}
.padding(.leading, -180)
.padding(.bottom, 100)
.padding()
Spacer()
if !day.isEmpty && !month.isEmpty && !year.isEmpty {
Button(action: {
// Action when the button is tapped
}) {
Image(systemName: "arrow.right.circle.fill")
.resizable()
.frame(width: 50, height: 50).foregroundColor(Color.white)
}
}
Spacer()
}