решена проблема
@objc func handlePan(gesture: UIPanGestureRecognizer) {
let translation = gesture.translation(in: nil)
switch gesture.state {
case .changed:
dragingText.center = CGPoint(x: dragingText.center.x + translation.x, y: dragingText.center.y + translation.y )
gesture.setTranslation(CGPoint.zero, in: nil)
case .ended:
let isInside = isInsideDragableAres()
if isInside.0 {
UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 0.4, initialSpringVelocity: 0.7, options: .curveEaseOut, animations: {
self.dragingText.center = CGPoint(x: self.view.center.x, y: self.dragingText.center.y + translation.y )
}, completion: nil)
}
else{
UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 0.4, initialSpringVelocity: 0.7, options: .curveEaseOut, animations: {
self.dragingText.center = CGPoint(x: self.view.center.x, y: isInside.1! )
}, completion: nil)
}
default:
()
}
}