Skip to content

Instantly share code, notes, and snippets.

@brianmpalma
Created February 10, 2015 17:56
Show Gist options
  • Save brianmpalma/e82be9f3519d6e315df0 to your computer and use it in GitHub Desktop.
Save brianmpalma/e82be9f3519d6e315df0 to your computer and use it in GitHub Desktop.
NSKeyValueCoding Informal Protocol
# NSKeyValueCoding
An informal protocol on NSObject. It provides an indirect way of setting values by key (property / iVar name) without using accessors or iVar access.
## Getting Values
```
- valueForKey:
- valueForKeyPath:
- dictionaryWithValuesForKeys:
- valueForUndefinedKey:
- mutableArrayValueForKey:
- mutableArrayValueForKeyPath:
- mutableSetValueForKey:
- mutableSetValueForKeyPath:
- mutableOrderedSetValueForKey:
- mutableOrderedSetValueForKeyPath:
```
## Setting Values
```
- setValueForKey:
- setValueForKeyPath:
- setNilValueForKey:
- setValuesForKeysWithDictionary:
- setValue;forUndefinedKey:
```
## Changing Default Behavior
```
+ accessInstanceVariablesDirectly
```
## Validation
```
- validateValue:forKey:error:
- validateValue:forKeyPath:error:
```
## Also Contains
The protocol also contains string constants for exceptions, error keys, and collection operators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment