I am a bit puzzled as to what is going on with the code below. I was under the impression that children
would be an optional based on node.children
(which is of type [AnyObject]
) being of type [SKNode]
What I am seeing is that children
is never nil
, is this because [AnyObject]
does not contain any type information? Even if I change [SKNode]
to [NSString]
it still goes to (1)?
if let children = node.children as? [SKNode] {
// (1) STUFF WITH SKNODE...
} else {
// (2) NOPE, ITS NOT AN SKNODE