I've got a button in SwiftUI that appears on a view depending on the count of an array, like this:
@State var arr ...
if arr.count > 0 {
Button("click me!") {
...
}
.frame(maxHeight: .infinity, alignment: .bottom)
}
I want to animate the button to slide up from the bottom of the screen when the array count goes above 0, rather than it just abruptly appearing on the screen.
I tried the following lines: .transition(.slide) followed by .animation(.spring(), value: arr.count), but these seemingly had no effect. How can I accomplish this animation?
Thank you in advance.