Summary of Key-value coding (part 2).

Morgan Kang
1 min readJul 24, 2021

Before reading.

This Summary is just write down when I study iOS.

So, it’s not good enough to read, plz understand about that.

Using Key-Value Compliant Objects.

If you inherit from ‘NSObject’ that directly or indirectly, which both adopts the ‘NSKeyValueCoding’ protocol.

(c.f : Objects typically adopt key-value coding when they inherit from ‘NSObject’)

And ‘NSKeyValueCoding’ provides a default implementation for the ‘essential methods.’

(c.f : ‘essential methods’ are such an object enables other objects, through a compact messaging interface.)

How to using Key-Value Compliant Objects ?

Access object properties.

The protocol methods such as the generic getter ‘valueForKey:’, the generic setter ‘setValue:forKey:’.

These are for accessing object properties by their name, or key.

(c.f : when accessing object properties by name or key, which parameterized as a ‘String’)

The default implementations of these and related methods use the key to locate and interact with the underlying data.

(c.f : Will summarize about ‘Accessing Object Properties’ for describe ‘the default implementations of these and related methods’)

--

--