Swift - Detect if subviews of different superview intersect
<p>I am trying to detect if two views intersect: a view that's a subview of the main storyboard, and a subview of a subview of the main storyboard.</p>

<p>I tried to use <code>subview1.frame.intersects(subview2.frame)</code>, and it doesn't work. The function above always returns <code>false</code>.</p>

<p>As for the context, I'm trying to drag subview1 and drop it onto subview2, and detect the collision between two views upon <code>.Ended</code> state of <code>PanGesture</code>.</p>

<p>The view hierarchy can be expressed as the following:</p>

<pre><code>     main view
    /         \
subview1      view2
                \
                subview2
</code></pre>