decodeIntegerForKey
decodeIntegerForKey is a method of the NSCoder family used to retrieve an integer value associated with a given key from an encoded data stream or archive. It is commonly used when unarchiving objects that were previously encoded with a corresponding encodeInteger:forKey: or related integer-encoding methods. The value returned is the integer (NSInteger) that was stored under the specified key.
In Objective-C, the method signature is typically - (NSInteger)decodeIntegerForKey:(NSString *)key;. In Swift, this capability is exposed as
Objective-C: NSInteger count = [decoder decodeIntegerForKey:@"count"];
Swift: let count = decoder.decodeInteger(forKey: "count")
Related methods include encodeInteger:forKey: and encodeInt:forKey: for writing, as well as decodeBoolForKey:, decodeDoubleForKey:, and decodeObjectForKey: for