In my game I have a NSCoding-conforming Combat class, which also uses GameplayKit's GKGridGraph and GKGridGraphNode objects, which do not conform to NSCoding. Is there a way to serialize/unserialize these objects?
Asked
Active
Viewed 65 times
1 Answers
0
As you've noted, there's no NSCoding
support in these classes. (That'd make a good feature request to send to Apple, though.)
It should be possible, however, to create your own serialized representation of a graph when encoding your classes, then read that in and initialize new GKGraph
and GKGraphNode
objects accordingly in your init(coder:)
implementation. Note that when doing so you'll have to carefully walk the graph yourself to capture all the node connections.

rickster
- 124,678
- 26
- 272
- 326