davecom / SwiftGraph

A Graph Data Structure in Pure Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add NSCoding Support

jeffd opened this issue · comments

By having a pure Swift implementation of a Graph, there's currently no way, as far as I can tell, to write a Graph to disk with NSKeyedArchiving / NSCoding.

That is correct. One could subclass Graph, UnweightedGraph, or WeightedGraph and specify NSCoding compliant vertices and add NSCoding conformance. Having such a class built-in to the framework would violate the framework's non-reliance on Foundation. I am interesting in exploring other serialization options including basic CSV text files for Graphs with String vertices, XML, and JSON.

The path forward on this will be conformance with the Swift 4 archival and serialization APIs.