NSKeyedUnarchiver
class NSKeyedUnarchiver
class NSKeyedUnarchiver
import Foundation
class NSCoder
The NSCoder
abstract class declares the interface used by concrete subclasses to transfer objects and other values 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 NSKeyedArchiver
and NSKeyedUnarchiver
. 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.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol NSObjectProtocol : AnyObject
The NSObjectProtocol
groups methods that are fundamental to all Foundation objects.
init(forReadingFrom data: Data) throws
static func unarchivedObject<DecodedObjectType>(ofClass cls: DecodedObjectType.Type, from data: Data) throws -> DecodedObjectType? where DecodedObjectType : NSObject, DecodedObjectType : NSCoding
static func unarchivedObject(ofClasses classes: [AnyClass], from data: Data) throws -> Any?
class func `class`(forClassName codedName: String) -> AnyClass?
class func setClass(_ cls: AnyClass?, forClassName codedName: String)
class func unarchiveTopLevelObjectWithData(_ data: Data) throws -> Any?
override var allowedClasses: [AnyClass]? { get }
override var allowsKeyedCoding: Bool { get }
override var decodingFailurePolicy: NSCoder.DecodingFailurePolicy { get set }
weak var delegate: (any NSKeyedUnarchiverDelegate)?
override var error: (any Error)? { get }
override var requiresSecureCoding: Bool { get set }
override var systemVersion: UInt32 { get }
func `class`(forClassName codedName: String) -> AnyClass?
override func containsValue(forKey key: String) -> Bool
override func decodeBool(forKey key: String) -> Bool
override func decodeData() -> Data?
override func decodeDouble(forKey key: String) -> Double
override func decodeFloat(forKey key: String) -> Float
override func decodeInt32(forKey key: String) -> Int32
override func decodeInt64(forKey key: String) -> Int64
override func decodeInteger(forKey key: String) -> Int
override func decodeObject() -> Any?
override func decodeObject(forKey key: String) -> Any?
override func decodeObject<DecodedObjectType>(of cls: DecodedObjectType.Type, forKey key: String) -> DecodedObjectType? where DecodedObjectType : NSObject, DecodedObjectType : NSCoding
override func decodeObject(of classes: [AnyClass]?, forKey key: String) -> Any?
override func decodePropertyList() -> Any?
override func decodePropertyList(forKey key: String) -> Any?
override func decodeValue(ofObjCType typep: UnsafePointer<Int8>, at addr: UnsafeMutableRawPointer)
func finishDecoding()
Called when the caller has finished decoding.
func setClass(_ cls: AnyClass?, forClassName codedName: String)
override func withDecodedUnsafeBytes<ResultType>(forKey key: String, body: (UnsafeRawBufferPointer?) throws -> ResultType) rethrows -> ResultType
convenience init(forReadingWith data: Data)
class func unarchiveObject(with data: Data) -> Any?
class func unarchiveObject(withFile path: String) -> Any?
override func withDecodedUnsafeBufferPointer<ResultType>(forKey key: String, body: (UnsafeBufferPointer<UInt8>?) throws -> ResultType) rethrows -> ResultType