I'm working with Swift 3 and Xcode.
I have a class :
class H: SKSpriteNode {...}
And an array :
var array = [H]()
I want to check with the nodes(at:)
function if at given point, there is an element of type H. I tried :
if nodes(at: myPoint).contains(H)
But it doesn't work, and I understand that. Is there any way to be able to know if the arrays the nodes(at)
function returns contains an element from the class H ?
And an other question, how can I check in all the nodes returned by the function, if the array contains a node with a specific name ?
Try to use .filter({ $0 is H }).count > 0
or .contains(where: { $0 is H })