Skip to content

Keep type information while using Swift Codable, to be able to encode and decode subclasses

License

Notifications You must be signed in to change notification settings

Yalir/TypedCodable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypedCodable

Heavily inspired from Swift 4.2 Decodable: Heterogeneous collections by Kewin Dannerfjord Remeczki.

Original code is modified in order to support NSKeyed(Un)archiver in addition to JSONEncoder/Decoder. Additionally, a TypedCodable protocol is introduced, to factorize the code snippet needed to introduce the type information at encoding time.

See Tests/TypedCodableTests/TypedCodableTests.swift for a usage example.

About

Keep type information while using Swift Codable, to be able to encode and decode subclasses

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages