I am trying to create an animation for presenting and dismissing a group of objects. I have:
if self.showSignInButtons {
Group {
Button(action: {}) { ... }
HStack { ... }
Button(action: {}) { ... }
}.transition(
AnyTransition.signInButtonTransition(
offset: geometry.size.height,
duration: 1.4,
delay: 50.0)
)
}
Here is the definition of the custom AnyTransition
animation
public extension AnyTransition {
static func signInButtonTransition(offset: CGFloat, duration: Double, delay: Double) -> AnyTransition {
let insertion = AnyTransition.offset(y: offset)
.animation(Animation.easeOut(duration: duration).delay(delay))
let removal = AnyTransition.offset(y: offset).animation(.default)
return .asymmetric(insertion: insertion, removal: removal)
}
}
My goal is to delay the insertion animation to create a sequence, but I don't want there to be a delay when the view is dismissed. The problem is the asymmetric animation is using the default animation despite the added animation modifier. Is there any reason the delay and duration animation on the insertion are being ignored?