Skip to content

AndyDentFree/perswifting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

perswifting

Persistence and wire formats in Swift

May contain multiple explorations in this area.

Codable

I started this to explore some aspects of Codable as of Swift 4 in particular supporting polymorphic class hierarchies.

See the CodableHierarchies\README.md for a detailed explanation of how polymorphic behaviour with protocols can be easily encoded using Codable.

PersistedHierarchies

See the PersistedHierarchies\README.md for a detailed explanation of how this alternative works, using binary encoding and preserving a class hierarchy.

Note that it uses a more robust method of registering factories using a string key, as a contrast to the very dangerous approach in CodableHierarchies where we save an index and rely on the programmer to get their factory array right with unique indexes for each type!

There are multiple playgrounds in there exploring increasing features through to backward references.

About

Persistence and wire formats in Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages