A comparison and demonstration between 3 ways of archiving and unarchiving Swift Structures. The playground ArchivingSwiftStructures1 is the most inelegant way of doing this. Look at ArchivingSwiftStructures2 and ArchivingSwiftStructures3 for more elegant ways. Swift made structures very powerful, and hence using structures more is very tempting. But, since NSCoding can only be conformed to by classes, archiving structure instances needs some workaround. Read through my article detailing ways to do this here: https://medium.com/p/e27744f26811/edit
vishalvshekkar / archivingswiftstructures Goto Github PK
View Code? Open in Web Editor NEWA comparison and demonstration between 3 ways of archiving and unarchiving Swift Structures. The playground ArchivingSwiftStructures1 is the most inelegant way of doing this. Look at ArchivingSwiftStructures2 and ArchivingSwiftStructures3 for more elegant ways. Swift made structures very powerful, and hence using structures more is very tempting. But, since NSCoding can only be conformed to by classes, archiving structure instances needs some workaround. Read through my article detailing ways to do this here: https://medium.com/@vishalvshekkar/swift-structure-instances-within-a-class-archived-with-nskeyedarchiver-e27744f26811#.a7k5jwl4a
License: MIT License