-
-
Save muhammadabbas001/9bdf5e2bff0ec7b56eba5bee42f4dbda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getOffset(_ i: Int) -> CGFloat { | |
if i == relativeLoc() { | |
return dragState.translation.width | |
} else if i == relativeLoc() + 1 || relativeLoc() == views.count - 1 && i == 0{ | |
return dragState.translation.width + (300 + 20) | |
} else if i == relativeLoc() - 1 || relativeLoc() == 0 && i == views.count - 1 { | |
return dragState.translation.width - (300 + 20) | |
} else if i == relativeLoc() + 2 || (relativeLoc() == views.count - 1 && i == 1) || (relativeLoc() == views.count - 2 && i == 0) { | |
return dragState.translation.width + (2*(300 + 20)) | |
} else if i == relativeLoc() - 2 || (relativeLoc() == 1 && i == views.count - 1) || (relativeLoc() == 0 && i == views.count - 2) { | |
return dragState.translation.width - (2*(300 + 20)) | |
} else if i == relativeLoc() + 3 || (relativeLoc() == views.count - 1 && i == 2) || (relativeLoc() == views.count - 2 && i == 1) || (relativeLoc() == views.count - 3 && i == 0){ | |
return dragState.translation.width + (3*(300 + 20)) | |
} else if i == relativeLoc() - 3 || (relativeLoc() == 2 && i == views.count - 1) || (relativeLoc() == 1 && i == views.count - 2) || (relativeLoc() == 0 && i == views.count - 3) { | |
return dragState.translation.width - (3*(300 + 20)) | |
} else { | |
return 10000 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment