Detect collision of two UIView's in swift
问题 I have two UIViews on my ViewController. I added panGesture to first view and when i start moving this view the second view will move towards first view. I want to detect an event when these two views collides. Here is my code. @IBAction func dragFirstView(sender: UIPanGestureRecognizer) { let translation = sender.translationInView(self.view) dispatch_async(dispatch_get_main_queue()) { () -> Void in UIView.animateWithDuration(2.5, delay: 0.0, options: UIViewAnimationOptions.CurveEaseOut,