O'Reilly logo

More iPhone Development with Swift: Exploring the iOS SDK by David Mark, Jayant Varma, Jeff LaMarche, Alex Horovitz, Kevin Kim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    6

Custom Managed Objects

At the moment, the Hero entity is represented by instances of the class NSManagedObject. Thanks to key-value coding, you have the ability to create entire data models without ever having to create a class specifically designed just to hold your application’s data.

This approach has some drawbacks, however. For one thing, when using key-value coding with managed objects, you use NSString constants to represent your attributes in code, but these constants are not checked in any way by the compiler. If you mistype the name of an attribute, the compiler won’t catch it. It can also be a little tedious having to use valueForKey: and setValue:forKey: all over the place instead of just using properties and dot notation. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required