CBLModel question

30 views
Skip to first unread message

Todd Freese

unread,
Nov 4, 2014, 12:15:54 AM11/4/14
to mobile-c...@googlegroups.com
Is it valid to call setValue:forKey on a CBLModel where the key is defined as a property?

The documentation makes it sound like this method is only for setting properties that are NOT defined as properties in the CBLModel subclass.

Todd

Jens Alfke

unread,
Nov 4, 2014, 12:57:37 AM11/4/14
to mobile-c...@googlegroups.com

On Nov 3, 2014, at 9:15 PM, Todd Freese <to...@filmworkers.com> wrote:

Is it valid to call setValue:forKey on a CBLModel where the key is defined as a property?

Do you mean setValue:ofProperty:? CBLModel doesn't implement -setValue:forKey:, it just inherits the default one, which I believe will use key-value coding and call through to property setters. (It probably fails for anything not declared as an @property, though.)

-setValue:ofProperty: will update the property whether or not it's also declared as an @property. It doesn't send KVO notifications, though.

—Jens

Todd Freese

unread,
Nov 4, 2014, 9:02:28 AM11/4/14
to mobile-c...@googlegroups.com
Thanks.

I'm so used to using setValue:forKey, that I didn't even notice setValue:ofProperty!

T
Reply all
Reply to author
Forward
0 new messages