Re: [Pyobjc-dev] Catergory Question ...
Brought to you by:
ronaldoussoren
From: Mic P. <mic...@gm...> - 2009-05-08 11:44:35
|
Okay, fantastic ! Would it be possible for you to give me an example of your last point (re: manual annotations for some method you may use in a category) as this is the only part I don't have any experience with ? I am looking to add two methods to NSString, one which returns a string and another which returns an array. This would be greatly appreciated. Thanks -Mic 2009/5/8 Ronald Oussoren <ron...@ma...>: > > On Friday, May 08, 2009, at 10:59AM, "Mic Pringle" <mic...@gm...> wrote: >>Hi, >> >>Just a quick question regarding categories. >> >>I have a hybrid Obj-c/PyObj-c application and I'd like to know if I >>add a category in a PyObj-c module, will it be availble to use in the >>Obj-c side of the project ?? >> >>If so, does it just work or are there any special instructions I need >>to follow to get it working ? > > Methods you add using an Python category are available in ObjC as well (the same is true for methods you add in a subclass, those can be called from ObjC as well). > > Two possible sources for confusion/problems: > > * Unless the methods you add are already known to the compiler you'll have to write a header file that the ObjC compiler > can use. You'll get compiler warnings otherwise. > > * Methods that you add in python by default have arguments and a return value of type 'id'. This can be overridden by: > > - information extracted from the superclass (if you override a method PyObjC knows the new method should have the > same signature as the one in a superclass). > - the method is defined in an informal_protocol that's known to PyObjC, the method signature is then extracted from > that protocol > - manual annotations (objc.accessor, objc.selector, ....) > > Ronald >>Thanks >> >>-Mic >> >>------------------------------------------------------------------------------ >>The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your >>production scanning environment may not be a perfect world - but thanks to >>Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 >>Series Scanner you'll get full speed at 300 dpi even with all image >>processing features enabled. http://p.sf.net/sfu/kodak-com >>_______________________________________________ >>Pyobjc-dev mailing list >>Pyo...@li... >>https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >> >> > |