Get UIView from CGRect using UIPanGestureRecognizer - Swift 2.0
<p>I'm working on an app that uses the <strong>UIPanGesturerecognizer</strong> to <strong>move</strong> a <strong>UIView</strong>. I have <strong>3</strong> more <strong>views</strong> on my Screen, more <strong>fixed</strong>.</p>

<p>The view that I will drag with the gesture, is in the color <strong>blue</strong>. The first view is fixed with the <strong>orange</strong> color. The second view is fixed with <strong>green</strong> color. The third view is fixed to the <strong>Purple</strong> color.</p>

<p><a href="https://i.stack.imgur.com/sNePk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sNePk.png" alt="enter image description here"></a></p>

<p>My actual Swift code:</p>

<pre><code>import UIKit

class ViewController: UIViewController {

    @IBOutlet var panView: UIView!

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)

        panView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: "panViewGesture:"))
    }

    func panViewGesture(sender: UIPanGestureRecognizer) {

        let locationInView = sender.locationInView(self.view)

        if sender.state == .Changed {

            panView.frame.origin = locationInView

        }

    }

}
</code></pre>

<p><strong>My Problem</strong>:</p>

<p>When the <strong>View Blue</strong> is on the <strong>View Orange</strong>, the <strong>View Orange</strong> should change the background color to blue, like the 'View Blue'.</p>

<p>The same happens with the <strong>View Green</strong> and <strong>View Purple</strong>.</p>

<hr>

<p><strong>What I'm trying to do:</strong></p>

<p>I'm trying to make a function that recognizes from CGRect data which is the view from below and returns a UIView.</p>

<p>Returning to UIView, I can easily change the background color.</p>

<hr>

<p><strong>What I need?</strong></p>

<p>I need a syntax that can make the recognition of view overlapped while using the UIPanGestureRecognizer to drag another UIView</p>

<hr>

<p>Can someone help me?</p>