Instance Method

decodeData()

Decodes and returns an NSData object that was previously encoded with encode(_:). Subclasses must override this method.

Declaration

func decodeData() -> Data?

Discussion

The implementation of your overriding method must match the implementation of your encode(_:) method. For example, a typical encode(_:) method encodes the number of bytes of data followed by the bytes themselves. Your override of this method must read the number of bytes, create an NSData object of the appropriate size, and decode the bytes into the new NSData object.

See Also

Decoding General Data

func decodeArray(ofObjCType: UnsafePointer<Int8>, count: Int, at: UnsafeMutableRawPointer)

Decodes an array of count items, whose Objective-C type is given by itemType.

func decodeBool(forKey: String) -> Bool

Decodes and returns a boolean value that was previously encoded with encode(_:forKey:) and associated with the string key.

func decodeBytes(forKey: String, returnedLength: UnsafeMutablePointer<Int>?) -> UnsafePointer<UInt8>?

Decodes a buffer of data that was previously encoded with encodeBytes(_:length:forKey:) and associated with the string key.

func decodeDouble(forKey: String) -> Double

Decodes and returns a double value that was previously encoded with either encode(_:forKey:) or encode(_:forKey:) and associated with the string key.

func decodeFloat(forKey: String) -> Float

Decodes and returns a float value that was previously encoded with encode(_:forKey:) or encode(_:forKey:) and associated with the string key.

func decodeCInt(forKey: String) -> Int32

Decodes and returns an int value that was previously encoded with encodeCInt(_:forKey:), encode(_:forKey:), encode(_:forKey:), or encode(_:forKey:) and associated with the string key.

func decodeInteger(forKey: String) -> Int

Decodes and returns an NSInteger value that was previously encoded with encodeCInt(_:forKey:), encode(_:forKey:), encode(_:forKey:), or encode(_:forKey:) and associated with the string key.

func decodeInt32(forKey: String) -> Int32

Decodes and returns a 32-bit integer value that was previously encoded with encodeCInt(_:forKey:), encode(_:forKey:), encode(_:forKey:), or encode(_:forKey:) and associated with the string key.

func decodeInt64(forKey: String) -> Int64

Decodes and returns a 64-bit integer value that was previously encoded with encodeCInt(_:forKey:), encode(_:forKey:), encode(_:forKey:), or encode(_:forKey:) and associated with the string key.

func decodeObject() -> Any?

Decodes and returns an object that was previously encoded with any of the encode…Object methods.

func decodeObject(forKey: String) -> Any?

Decodes and returns a previously-encoded object that was previously encoded with encode(_:forKey:) or encodeConditionalObject(_:forKey:) and associated with the string key.

func decodePoint() -> NSPoint

Decodes and returns an NSPoint structure that was previously encoded with encode(_:).

func decodePoint(forKey: String) -> NSPoint

Decodes and returns an NSPoint structure that was previously encoded with encode(_:forKey:).

func decodePropertyList() -> Any?

Decodes a property list that was previously encoded with encodePropertyList(_:).

func decodeRect() -> NSRect

Decodes and returns an NSRect structure that was previously encoded with encode(_:).

func decodeRect(forKey: String) -> NSRect

Decodes and returns an NSRect structure that was previously encoded with encode(_:forKey:).

func decodeSize() -> NSSize

Decodes and returns an NSSize structure that was previously encoded with encode(_:).

func decodeSize(forKey: String) -> NSSize

Decodes and returns an NSSize structure that was previously encoded with encode(_:forKey:).

func decodeValue(ofObjCType: UnsafePointer<Int8>, at: UnsafeMutableRawPointer)

Decodes a single value, whose Objective-C type is given by valueType.

Deprecated
func decodeValue(ofObjCType: UnsafePointer<Int8>, at: UnsafeMutableRawPointer, size: Int)

Decodes a single value of a known type from the specified data buffer.

func decodePropertyList(forKey: String) -> Any?

Returns a decoded property list for the specified key.