I have code like this:
VStack{
if (DeleteScreen.sharedInstance.postDelete){
VStack{
GeometryReader{_ in
DeletePostAlert()
.frame(maxWidth: .infinity, alignment: .center)
.frame(maxHeight: .infinity, alignment: .center)
.transition(AnyTransition.opacity.animation(.easeInOut(duration: 0.2)))
}.background(Color.black.opacity(0.65))
.onDisappear{
}
.onAppear{
}
}
}
}
where the DeletePost alert is defined like this:
class DeleteScreen: ObservableObject {
static let sharedInstance = DeleteScreen()
@Published var postDelete: Bool = false
}
However, for some reason, the transition animations are not working. I'm trying to get the DeletePostAlert() to fade in or slide in or something but so far everything I've tried has not worked. I've also tried something like .animation(.spring()), but to no avail.
Any guidance as to what I'm doing wrong here would be appreciated.
Thanks