Any idea on how to sort an array of SKShapeNode
elements by their names? Let just assume each SKShapeNode.name
property is a number 100,23,31,... All of them are group into shapeNodesCollection
. What should be done to sort it out into another array - shapeNodesCollectionSorted
? Below you can find some abstract code.
class Example: GameScene {
...
var shapeNodesCollection = [SKShapeNode]()
var shapeNodesCollectionSorted = [SKShapeNode]()
...
shapeNodesCollectionSorted = ... //sorted shapeNodesCollection
}
Many thanks to anyone for any contribution.