let translation = gesture.translation(in: nil)
let shouldDismissCard = translation.x > threshold || translation.x < -threshold
UIView.animate(withDuration: 0.75, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0.1, options: .curveEaseOut, animations: {
if shouldDismissCard {
//
//
if translation.x > self.threshold {
self.frame = CGRect(x: 1000, y: 0, width: self.frame.width, height: self.frame.height)
}else if translation.x < -self.threshold {
self.frame = CGRect(x: -1000, y: 0, width: self.frame.width, height: self.frame.height)
}
// let offScreenTransform = self.transform.translatedBy(x: 1000, y: 0)
// self.transform = offScreenTransform
}else {
self.transform = .identity
}
}) { (_) in
self.transform = .identity
self.frame = CGRect(x: 0, y: 0, width: self.superview!.frame.width, height: self.superview!.frame.height)
}