• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Validating NSButton in Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Validating NSButton in Swift


  • Subject: Re: Validating NSButton in Swift
  • From: Roland King <email@hidden>
  • Date: Mon, 14 Dec 2015 15:53:26 +0800

> On 14 Dec 2015, at 15:42, Luc Van Bogaert <email@hidden> wrote:
>
> 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.

You appear to be a little out of luck here because

NSValidatedUserInterfaceItem requires two *functions*

public func tag()->Int
public func action()->Selector

however NSControl implements two *properties*

public var tag : Int { get set }
public var action : Selector { get set }

and even though the getter for those has the same signature you can’t substitute one for another. Nor can you add a function on the subclass which shadows the equivalently-named property on the superclass so .. it rather looks like you can’t do it.

Can you declare this small piece of it in ObjC and import the classes, while Apple considers the bug report you will no-doubt file on it.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Validating NSButton in Swift
      • From: Quincey Morris <email@hidden>
References: 
 >Validating NSButton in Swift (From: Luc Van Bogaert <email@hidden>)
 >Re: Validating NSButton in Swift (From: Quincey Morris <email@hidden>)
 >Re: Validating NSButton in Swift (From: Luc Van Bogaert <email@hidden>)

  • Prev by Date: Re: Validating NSButton in Swift
  • Next by Date: Re: Validating NSButton in Swift
  • Previous by thread: Re: Validating NSButton in Swift
  • Next by thread: Re: Validating NSButton in Swift
  • Index(es):
    • Date
    • Thread