Search code examples
objective-csubclassingnscoder

Sample (preferably simple) subclass of NSCoder?


I'm trying to create a subclass of NSCoder, but I really don't know where to start. Apple's documentation lists which methods are required, but not much else. Maybe my Google-fu is weak, but I can't find any examples of an implementation of, e.g. encodeValueOfObjCType:at:, anywhere. (Though I assume it involves a lot of cases.)

Anyone know of a sample subclass of NSCoder I can look at, or have an idea of what a case or two of encodeValueOfObjCType:at: and decodeValueOfObjCType:at: should look like?


Solution

  • I just open-sourced a NSCoder subclass here It basically is a replica of the deprecated NSArchiver. Should get anyone who stumble into this question started.