Home > DeveloperSection > Interviews > Whats the NSCoder class used for?

Posted on    July-29-2015 11:27 PM

 iPhone iPhone  Ios  Objective C 
 1 Answer(s)
  2022  View(s)
Rate this:

Felix Pickles
Felix Pickles

Total Post:3

Posted on    July-29-2015 11:27 PM

NSCoder is an abstractClass which represents a stream of data. They are used in Archiving and Unarchiving objects. NSCoder objects are usually used in a method that is being implemented so that the class conforms to the protocol. (which has something like encodeObject and decodeObject methods in them).

NSCoder operates on objects, scalars, C arrays, structures, and strings, and on pointers to these types. It does not handle types whose implementation varies across platforms, such as union, void *, function pointers, and long chains of pointers. A coder object stores object type information along with the data, so an object decoded from a stream of bytes is normally of the same class as the object that was originally encoded into the stream.

Don't want to miss updates? Please click the below button!

Follow MindStick