You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Native swift types like Array only conform to Codable when their elements are Codable.
It looks like Graph doesn't have any special need for being Codable.
Would it be possible to make Graph conform to Codable only when its vertices are? I've a use case where I'm not interested in the Graph being codable and adding conformance to the vertex type would be a lot of work.
The text was updated successfully, but these errors were encountered:
That's a good question. I think we already went through attempting to make Codable conditional in an earlier version of Swift but ran into some compiler limitations. I would guess this is possible now.
A couple alternatives you could do for now:
Make a unique ID for each vertex that you use in SwiftGraph and lookup the ancillary data for your specific needs in a separate data structure like a simple Dictionary mapping IDs to data
Add Codable conformance to an existing data type in an extension that just ignores the values that are not possible to make Codable
Hi,
Native swift types like
Array
only conform toCodable
when their elements areCodable
.It looks like
Graph
doesn't have any special need for beingCodable
.Would it be possible to make
Graph
conform toCodable
only when its vertices are? I've a use case where I'm not interested in theGraph
being codable and adding conformance to the vertex type would be a lot of work.The text was updated successfully, but these errors were encountered: