The SKNode header file states that isEqual(to:) "Returns true if this node has equivalent content to the other object, otherwise false".
Here is an example:
let node1 = SKNode()
node1.name = "node"
let node2 = SKNode()
node2.name = "node"
let node3 = SKNode()
node3.name = "differentNode"
print(node1.isEqual(to: node2)) // true (even though the nodes have different parents, they have the same content, so this is true)
print(node1.isEqual(to: node3)) // false (even though the nodes have the same parents, they have different content, so this is false)
print(node2.isEqual(to: node3)) // false (the nodes have different parents and different content, so this is false)
As you can see from this example, the content of the node is the important differentiator when using isEqual(to:).
Thanks for the reply. You saved my effort a lot!
However, your answer gave me another question as the followings:
From the description
trueif the node is a descendant of the
It seems that it also care about the parent node.
But you said it the function only cares about the content.
Then does the description itself has the its own flaw? If so, please bug report to Apple.
Unless I do the experimental coding, it would be difficult to know what's going on, because Apple's description give rise to confusion.
Thanks in advance.