What do you mean by "iterated"? If I understand your subject correctly... This can be used when node 1 is just partially within the boundary of the second node:
if node1.intersects(node2) { }
If you want to know, whether your first node is entirely within the boundaries of the second node, this should work:
// Node 1 intersects HEIGHT of Node2
if ( node1BottomY <= node2TopY && node1TopY >= node2BottomY ) || ( node1TopY >= node2BottomY && node1BottomY <= node2TopY )
{
intersectsHeight = true
}
// Node 1 intersects WIDTH of Node 2
if ( node1LeftX <=node2RightX && node1RightX >= node2LeftX ) || ( node1RightX >= node2LeftX && node1LeftX <= node2RightX )
{
intersectsWidth = true
}
// If Node1 intersects both height and width of Node 2, it is completely withoin its boundaries:
if intersectsHeight == true && intersectsWidth == true { }
This is how you may check if half of the first node intesects the second node:
if node2.contains(CGPoint(x: node1.frame.midX, y: node1.frame.midY))