I would like the button title to appear from bottom up, right now it appears a bit from the left to right and second time a bit from the right to the left. How can I get the desired effect please? Tried .move transition, does not work.
struct TestView: View {
@State var isNewUser : Bool = true
var body: some View {
VStack{
Button {
isNewUser ? signUp() : signIn()
}
label: {
Text( isNewUser ? "create account" : "sign in")
}
.accentColor(.white)
.frame(minWidth: 0, maxWidth: .infinity)
.padding()
.background( isNewUser ? .red : .green)
.cornerRadius(10)
.foregroundColor(Color.white)
.padding()
Button {
withAnimation(.easeIn(duration:0.5))
{
isNewUser.toggle()
}
} label: {
Text( isNewUser ? "Already have an account? Sign in" : "Do not have an account? Sign up." )
}
}
}
func signUp() {
print("signing up")
}
func signIn() {
print("signing in")
}
}