2017 .
for case let child as SKSpriteNode in parentNode.children {
}
.
: .
.
, "" " ", , , . , .
, ...
for case let s as SomeSpriteClass in children { k += 1 }
let t1 = a.microseconds()
let b = Date()
for s in spaceships { k += 1 }
let t2 = b.microseconds()
print("\(t1) \(t2)")
it's 3 or 4 times faster if you just iterate over your own list.
Typical iPad output ...
939 43
140 33
127 33
117 37
109 30
126 33
127 33
109 29
96 30
96 29
99 30
97 30
97 30
(In particular, as you would expect, the built-in enumeration takes forever the "first" time.)
Given performance, in practice, you need to keep your own list of sprites and do it.
Fatie source
share