From: Dan Tapp Date: 2004-07-07T05:57:37+09:00 Subject: Re: [RubyCocoa] Cocoa Bindings? (cont.) Harry wrote: > It's ugly, but a KVC-compliant object needs set methods. But this > gave me the same error. > > How to make Book KVC-compliant??? > > thx, > Harry Harry, I'm kind of flying blind here, but from what I remember about Apple's KeyValueCoding protocol, it's only necessary to implement a couple of methods. In more-or-less Obj-C form (I'm rusty), the first two are - (id)valueForKey: aKey - (void *)takeValue: someValue forKey: someKey In other words, KVC is designed to circumvent setFoo/getFoo methods, not to require them. There is, IIRC, at least one other method needed for strict compliance, somthing to do with handling unbound (unrecognized) keys, but I can't remember the precise name or use. I think on the Foundation Kit side, Apple may still include some default KVC behavior to relieve you from the need of implementing this. Also, you might make sure that you're passing in first-class objects (as Obj-C defines them, meaning non-scalars). Earlier versions of Foundation Kit permitted a mixed approach, depending on the type of the ivar, but I do believe that later, Java-based versions standardized on wrapped primitives. I hope at least some of that is useful, and wish I had Cocoa + Ruby to fiddle with these days :-) - dan -- ... ... dhtapp is a cox dot net account ...