I'm stuck trying to encode an array.
I have a class as following:
class EnemyMoveComponentSystem: GKComponentSystem<GKComponent> {
func updateWithDeltaTime(seconds: TimeInterval, gameScene: GameScene) {
for component in components {
if let enemyMoveComponent = component as? EnemyMoveComponent {
enemyMoveComponent.update(deltaTime: seconds, gameScene: gameScene)
}
}
}
}
Then I declared an array as following:
var enemyMoveComponentSystems: [EnemyMoveComponentSystem] = []
However, when i tried to encode the array as below I get error:
override func encode(with aCoder: NSCoder) {
aCoder.encode(enemyMoveComponentSystems, forKey: "Scene.enemyMoveComponentSystems")
}
Any help is appreciated.