Platforms to show: All Mac Windows Linux Cross-Platform

NSCoderMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The plugin class for NSCoder.
Example
// make archiver
dim a as new NSKeyedArchiverMBS

// add a string
a.encodeString "Hello World", "Greeting"

// finish
a.finishEncoding

// query data
dim m as MemoryBlock = a.archiverData

// start unarchiver
dim u as new NSKeyedUnarchiverMBS(m)

// query and display a value
dim s as string = u.decodeString("Greeting")
MsgBox s

The NSCoder abstract class declares the interface used by concrete subclasses to transfer objects and other Objective-C data items between memory and some other format. This capability provides the basis for archiving (where objects and data items are stored on disk) and distribution (where objects and data items are copied between different processes or threads). The concrete subclasses provided by Foundation for these purposes are NSArchiver, NSUnarchiver, NSKeyedArchiver, NSKeyedUnarchiver, and NSPortCoder. Concrete subclasses of NSCoder are referred to in general as coder classes, and instances of these classes as coder objects (or simply coders). A coder object that can only encode values is referred to as an encoder object, and one that can only decode values as a decoder object.

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. An object can change its class when encoded, however; this is described in Archives and Serializations Programming Guide.

For details of how to create a subclass of NSCoder, see "Subclassing NSCoder" in Archives and Serializations Programming Guide.

The plugin implements this class because it is needed to encode and decode the window state.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

Sub classes:

Some methods using this class:

Some events using this class:

Some examples using this class:

Blog Entries

Release notes

  • Version 23.2
    • Added decodeTypedStream method to NSCoderMBS class.

The items on this page are in the following plugins: MBS MacBase Plugin.


NSClipViewMBS   -   NSCollectionViewFlowLayoutInvalidationContextMBS


The biggest plugin in space...