>> I am encountering what I believe to be a spurious compiler warning. I wonder >> whether this is a clue that I am doing something differently to how I >> "should" do it. The problem comes if I define a protocol containing a >> property and then define that property in a base class that does NOT conform >> to the (whole) protocol. When I subclass that base class, I get warnings >> about how the property is not defined. >> >> // I find myself writing "@dynamic genericProperty" here to shut up the >> compiler warning >> // that reads "warning: property 'genericProperty' requires method >> '-genericProperty' to be defined - use @synthesize, @dynamic or provide a >> method implementation" > > It is my understanding that this is one of the reasons why @dynamic exists. > i.e. I believe that you are already doing the Right Thing. > > From the docs > > "You use the @dynamic keyword to tell the compiler that you will fulfill the > API contract implied by a property either by providing method implementations > directly or at runtime using other mechanisms such as dynamic loading of code > or dynamic method resolution. It suppresses the warnings that the compiler > would otherwise generate if it can’t find suitable implementations. You > should only use it if you know that the methods will be available at runtime." > > Well you know the method will exist at run time since you know your class is > a subclass of a class that implements it.
OK fair enough, thanks for replying. It's good to have a second opinion confirm it! I just found it a bit odd because the compiler should very easily be able to tell that the method does exist. Jonny_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com