> On 14 Dec 2015, at 00:18, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Dec 13, 2015, at 14:59 , Luc Van Bogaert <luc.van.boga...@me.com 
> <mailto:luc.van.boga...@me.com>> wrote:
>> 
>> I have a NSButton subclass that I want to conform to 
>> NSValidatedUserInterfaceItem, so I can call validateUserInterfaceItem: on a 
>> validator passing the button as a parameter. This requires my subclass to 
>> implement two methods: action() and tag(). The compiler complains about the 
>> selectors being identical to the 'action' and 'tag' selectors in superclass 
>> NSControl.
> 
> What do your subclass implementations look like (the signature, not the body)?
> 
> According to the documentation, NSControl already has the conforming 
> properties, so you don’t need to define your own. Just assign the correct 
> values to the existing properties.
> 
> However, the Swift version of NSValidatedUserInterfaceItem declares the 
> properties as methods, so this may be confusing the issue. In Obj-C, it’s all 
> the same thing — the getter for “action” is also the method “action”, but I’m 
> not sure what happens during bridging. (It ought to realize they’re the same 
> thing.)
> 
> What happens if you *don’t* declare action and tag in your subclass? Is there 
> a non-conformance warning?



I've defined the subclass like this: 

class ValidatedButton: NSButton, ValidatedControl {


I've defined ValidatedControl like this:

protocol ValidatedControl: NSValidatedUserInterfaceItem {


This results in a compiler error: Type ValidatedButton does not conform to 
protocol NSValidatedUserInterfaceItem.
I've tried overriding the NSControl properties 'action' and 'tag', but the 
error remains. 

-- 
Luc
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to