requiresSecureCoding
requiresSecureCoding is a flag used in Apple’s data serialization APIs to enforce secure coding during unarchiving. It is a property associated with NSKeyedUnarchiver and related archiving APIs, and when enabled, it requires that all decoded objects conform to the NSSecureCoding protocol and are decoded using secure methods that specify allowed classes. This mechanism helps prevent security risks such as object substitution attacks when deserializing data from untrusted sources.
Background: NSSecureCoding is an extension of NSCoding that adds security guarantees for archiving and unarchiving. Classes
Usage: In Swift, you typically configure the unarchiver to require secure coding and then decode using class-restricted
Limitations: Not all previously created archives can be decoded under secure coding; the decoded classes must
See also: NSSecureCoding, NSKeyedArchiver, NSKeyedUnarchiver, NSCoder.