mesutd0nmez
4/7/2017 - 6:41 AM

Swipe Left To Right

Swipe Left To Right

func setInit() {
  // Adding Gesture to View
  let leftGesture = UISwipeGestureRecognizer(target: self, action: #selector(self.handleLeftSwipe))
  leftGesture.direction = .right
  self.view.addGestureRecognizer(leftGesture)
  self.tableView.addGestureRecognizer(leftGesture)
}



// Close Activity While Swift Left To Right
func handleLeftSwipe(sender: UISwipeGestureRecognizer) {
  let transition: CATransition = CATransition()
  transition.duration = 0.5
  transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
  transition.type = kCATransitionPush
  transition.subtype = kCATransitionFromLeft
  self.view.window!.layer.add(transition, forKey: nil)
  self.dismiss(animated: false, completion: nil)
}