One Logo Pool Ball
Foundation · IOS API REFERENCE

NSCoder

class · SDK 27.1

class NSCoder

Members (53)

method

containsValue

TypeScript
containsValue(key: string): boolean
Swift declaration
func containsValue(forKey key: String) -> Bool
method

decodeArray

TypeScript
decodeArray(itemType: SDKHandle, count: number, array: SDKHandle): void
Swift declaration
func decodeArray(ofObjCType itemType: UnsafePointer<CChar>, count: Int, at array: UnsafeMutableRawPointer)
method

decodeBool

TypeScript
decodeBool(key: string): boolean
Swift declaration
func decodeBool(forKey key: String) -> Bool
method · iOS 18.4+

decodeBytes

TypeScript
decodeBytesForKeyMinimumLength(key: string, length: number): (SDKHandle) | null
Swift declaration
func decodeBytes(forKey key: String, minimumLength length: Int) -> UnsafePointer<UInt8>?
method

decodeBytes

TypeScript
decodeBytesForKeyReturnedLength(key: string, lengthp?: (SDKHandle) | null): (SDKHandle) | null
Swift declaration
func decodeBytes(forKey key: String, returnedLength lengthp: UnsafeMutablePointer<Int>?) -> UnsafePointer<UInt8>?
method · iOS 18.4+

decodeBytes

TypeScript
decodeBytesWithMinimumLength(length: number): (SDKHandle) | null
Swift declaration
func decodeBytes(withMinimumLength length: Int) -> UnsafeMutableRawPointer?
method

decodeBytes

TypeScript
decodeBytesWithReturnedLength(lengthp: SDKHandle): (SDKHandle) | null
Swift declaration
func decodeBytes(withReturnedLength lengthp: UnsafeMutablePointer<Int>) -> UnsafeMutableRawPointer?
method

decodeData

TypeScript
decodeData(): (ArrayBuffer) | null
Swift declaration
func decodeData() -> Data?
method

decodeDouble

TypeScript
decodeDouble(key: string): number
Swift declaration
func decodeDouble(forKey key: String) -> Double
method

decodeFloat

TypeScript
decodeFloat(key: string): number
Swift declaration
func decodeFloat(forKey key: String) -> Float
method

decodeInt32

TypeScript
decodeInt32(key: string): number
Swift declaration
func decodeInt32(forKey key: String) -> Int32
method

decodeInt64

TypeScript
decodeInt64(key: string): number
Swift declaration
func decodeInt64(forKey key: String) -> Int64
method

decodeCInt

TypeScript
decodeCInt(key: string): number
Swift declaration
func decodeCInt(forKey key: String) -> Int32
method · iOS 2.0+

decodeInteger

TypeScript
decodeInteger(key: string): number
Swift declaration
func decodeInteger(forKey key: String) -> Int
method

decodeObject

TypeScript
decodeObject(): (unknown) | null
Swift declaration
func decodeObject() -> Any?
method

decodeObject

TypeScript
decodeObjectForKey(key: string): (unknown) | null
Swift declaration
func decodeObject(forKey key: String) -> Any?
method · iOS 6.0+

decodePropertyList

TypeScript
decodePropertyList(key: string): (unknown) | null
Swift declaration
func decodePropertyList(forKey key: String) -> Any?
method · iOS 2.0+ · Deprecated in iOS 100000.0

decodeValue

TypeScript
decodeValueOfObjCTypeAt(type: SDKHandle, data: SDKHandle): void
Swift declaration
func decodeValue(ofObjCType type: UnsafePointer<CChar>, at data: UnsafeMutableRawPointer)
method · iOS 11.0+

decodeValue

TypeScript
decodeValueOfObjCTypeAtSize(type: SDKHandle, data: SDKHandle, size: number): void
Swift declaration
func decodeValue(ofObjCType type: UnsafePointer<CChar>, at data: UnsafeMutableRawPointer, size: Int)
method

encodeArray

TypeScript
encodeArray(type: SDKHandle, count: number, array: SDKHandle): void
Swift declaration
func encodeArray(ofObjCType type: UnsafePointer<CChar>, count: Int, at array: UnsafeRawPointer)
method

encode

TypeScript
encodeForKey(value: boolean, key: string): void
Swift declaration
func encode(_ value: Bool, forKey key: String)
method

encodeBycopyObject

TypeScript
encodeBycopyObject(anObject?: (unknown) | null): void
Swift declaration
func encodeBycopyObject(_ anObject: Any?)
method

encodeByrefObject

TypeScript
encodeByrefObject(anObject?: (unknown) | null): void
Swift declaration
func encodeByrefObject(_ anObject: Any?)
method

encodeBytes

TypeScript
encodeBytesLength(byteaddr: (SDKHandle) | null, length: number): void
Swift declaration
func encodeBytes(_ byteaddr: UnsafeRawPointer?, length: Int)
method

encodeBytes

TypeScript
encodeBytesLengthForKey(bytes: (SDKHandle) | null, length: number, key: string): void
Swift declaration
func encodeBytes(_ bytes: UnsafePointer<UInt8>?, length: Int, forKey key: String)
method

encodeConditionalObject

TypeScript
encodeConditionalObject(object?: (unknown) | null): void
Swift declaration
func encodeConditionalObject(_ object: Any?)
method

encodeConditionalObject

TypeScript
encodeConditionalObjectForKey(object: (unknown) | null, key: string): void
Swift declaration
func encodeConditionalObject(_ object: Any?, forKey key: String)
method

encode

TypeScript
encode(data: ArrayBuffer): void
Swift declaration
func encode(_ data: Data)
method

encode

TypeScript
encodeForKey96701(value: number, key: string): void
Swift declaration
func encode(_ value: Double, forKey key: String)
method

encode

TypeScript
encodeForKey94126(value: number, key: string): void
Swift declaration
func encode(_ value: Float, forKey key: String)
method

encode

TypeScript
encodeForKey31516(value: number, key: string): void
Swift declaration
func encode(_ value: Int32, forKey key: String)
method

encode

TypeScript
encodeForKey48863(value: number, key: string): void
Swift declaration
func encode(_ value: Int64, forKey key: String)
method

encodeCInt

TypeScript
encodeCInt(value: number, key: string): void
Swift declaration
func encodeCInt(_ value: Int32, forKey key: String)
method · iOS 2.0+

encode

TypeScript
encodeForKey12026(value: number, key: string): void
Swift declaration
func encode(_ value: Int, forKey key: String)
method

encode

TypeScript
encode55445(object?: (unknown) | null): void
Swift declaration
func encode(_ object: Any?)
method

encode

TypeScript
encodeForKey11807(object: (unknown) | null, key: string): void
Swift declaration
func encode(_ object: Any?, forKey key: String)
method

encodeRootObject

TypeScript
encodeRootObject(rootObject: unknown): void
Swift declaration
func encodeRootObject(_ rootObject: Any)
method

encodeValue

TypeScript
encodeValue(type: SDKHandle, addr: SDKHandle): void
Swift declaration
func encodeValue(ofObjCType type: UnsafePointer<CChar>, at addr: UnsafeRawPointer)
method · iOS 9.0+

failWithError

TypeScript
failWithError(error: NativeError): void
Swift declaration
func failWithError(_ error: any Error)
init

init

TypeScript
static init(): NSCoder
Swift declaration
init()
method

version

TypeScript
version(className: string): number
Swift declaration
func version(forClassName className: String) -> Int
get · iOS 6.0+

allowedClasses

TypeScript
get allowedClasses(): (Array<unknown>) | null
Swift declaration
var allowedClasses: Set<AnyHashable>? { get }
get

allowsKeyedCoding

TypeScript
get allowsKeyedCoding(): boolean
Swift declaration
var allowsKeyedCoding: Bool { get }
get · iOS 9.0+

decodingFailurePolicy

TypeScript
get decodingFailurePolicy(): NSCoder_DecodingFailurePolicy
Swift declaration
var decodingFailurePolicy: NSCoder.DecodingFailurePolicy { get }
get · iOS 9.0+

error

TypeScript
get error(): (NativeError) | null
Swift declaration
var error: (any Error)? { get }
get · iOS 6.0+

requiresSecureCoding

TypeScript
get requiresSecureCoding(): boolean
Swift declaration
var requiresSecureCoding: Bool { get }
get

systemVersion

TypeScript
get systemVersion(): number
Swift declaration
var systemVersion: UInt32 { get }
method · iOS 8.0+

decodeObject

TypeScript
decodeObjectOfForKey(classes: (Array<string>) | null, key: string): (unknown) | null
Swift declaration
@nonobjc func decodeObject(of classes: [AnyClass]?, forKey key: String) -> Any?

Decode an object as one of several expected types, failing if the archived type doesn't match any of the types. This method is equivalent to ``decodeObject(of:forKey:)-7tmft``, but accepts a set of classes that the decoded object can match. If ``requiresSecureCoding`` is `true`, the decoded object's class must be a member of the `classes` parameter, or a subclass of a member. - Parameters: - classes: An array of expected classes that the object being decoded should match at least one of. - key: The key indicating the member to decode. - Returns: The decoded object, or `nil` if decoding fails.

method · iOS 14.0+

decodeDictionary

TypeScript
decodeDictionary(keyClasses: Array<string>, classes: Array<string>, key: string): (NativeMap<unknown, unknown>) | null
Swift declaration
@nonobjc func decodeDictionary(withKeysOfClasses keyClasses: [AnyClass], objectsOfClasses classes: [AnyClass], forKey key: String) -> [AnyHashable : Any]?
method · iOS 14.0+

decodeArrayOfObjects

TypeScript
decodeArrayOfObjects(classes: Array<string>, key: string): (Array<unknown>) | null
Swift declaration
@nonobjc func decodeArrayOfObjects(ofClasses classes: [AnyClass], forKey key: String) -> [Any]?
method · iOS 9.0+

decodeTopLevelObject

TypeScript
decodeTopLevelObjectOfForKey(classes: (Array<string>) | null, key: string): (unknown) | null
Swift declaration
@nonobjc func decodeTopLevelObject(of classes: [AnyClass]?, forKey key: String) throws -> Any?

Decode an object as one of several expected types, failing if the archived type does not match. This method is equivalent to ``decodeObject(of:forKey:)-7tmft``, but allows you to specify a set of classes that the decoded object can match. If ``requiresSecureCoding`` is `true`, the decoded object's class must be a member of the `classes` parameter, or a subclass of a member. - Parameters: - classes: An array of expected classes that the object being decoded should match at least one of. - key: The key indicating the member to decode. - Returns: The decoded object, or `nil` if decoding fails.

method · iOS 9.0+ · Deprecated in iOS 100000.0

decodeTopLevelObject

TypeScript
decodeTopLevelObjectForKey(key: string): (unknown) | null
Swift declaration
@nonobjc func decodeTopLevelObject(forKey key: String) throws -> Any?

Decodes the previously-encoded object associated by a key. - Parameter key: The key that identifies the object to decode. - Returns: The decoded object, or `nil` if decoding fails.

method · iOS 9.0+ · Deprecated in iOS 100000.0

decodeTopLevelObject

TypeScript
decodeTopLevelObject(): (unknown) | null
Swift declaration
@nonobjc func decodeTopLevelObject() throws -> Any?

Decodes a previously-encoded object. - Returns: The decoded object, or `nil` if decoding fails.

Skipped declarations

4 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

NSCoder.decodeObject(of:forKey:)

The iOS SDK compiler rejected this binding: 'Any?' is not convertible to 'NSObject?'

NSCoder.decodeTopLevelObject(of:forKey:)

The iOS SDK compiler rejected this binding: 'Any' is not convertible to 'NSObject?'

NSCoder.decodeArrayOfObjects(ofClass:forKey:)

The iOS SDK compiler rejected this binding: instance method 'decodeArrayOfObjects(ofClass:forKey:)' requires that 'NSObject' conform to 'NSSecureCoding'

NSCoder.decodeDictionary(withKeyClass:objectClass:forKey:)

The iOS SDK compiler rejected this binding: instance method 'decodeDictionary(withKeyClass:objectClass:forKey:)' requires that 'NSObject' conform to 'NSCopying'

All Foundation types →