Book Image

Objective C Memory Management Essentials

Book Image

Objective C Memory Management Essentials

Overview of this book

Table of Contents (18 chapters)
Objective-C Memory Management Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 7. Key-value Programming Approaches

Key-value coding is a really cool function that works well with key-value observing. It allows you to code less and create very elegant solutions and code modules. There are many cases in a real application when something changes and another part of the application should be affected. The thing is that you can do anything when a property of an instance or class changes, including but not limited to checking whether its value is valid, sending a message to someone when something changes to a certain value, and so on. The options are unlimited.

We will cover the following topics in this chapter:

  • What is key-value coding?

  • The NSKeyValueCoding protocol

  • Manual subsets of the NSKeyValueCoding behavior

  • Associated objects

  • Selectors as keys

  • Maximum flexibility and handling unusual keys/values

Also, do note that the NSKeyValueCoding protocol has been available since Mac OS X 10.0 in Cocoa, and it has also made its appearance in iOS 2.0, which came out in July 11...