I have a swift handler that detects when a user swipes a view. If they swipe the view with their finger, I want the view to follow their finger until a certain point, then slow down and lag behind the finger. (For example when you drag a tableView past its top, and it "lags" behind your finger). Is there a formula I can use to do this?
My code so far (its in the swipe action function)
// Transform if it is going left
if (translation.x <= 0) {
// If reply has not been triggered yet, match view position to finger position
if (!replyTriggered) {
self.transform = CGAffineTransform(translationX: translation.x, y: 0)
}
// If it has been triggered, make movement less and less
else {
let translationX = "????"
self.transform = CGAffineTransform(translationX: translationX, y: 0)
}
}