• 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: Quincey Morris <email@hidden>
  • Date: Mon, 14 Dec 2015 01:20:56 -0800
  • Feedback-id: 167118m:167118agrif8a:167118sMq8b-DuqV:SMTPCORP

On Dec 14, 2015, at 01:12 , email@hidden wrote:
>
> because it inherits from a class that conforms to the protocol

NSControl conforms informally (that is, it has the requisite methods) but not formally, which isn’t conformance in Swift terms. But there’s still a conflict between properties and methods, which seems to matter to the Swift compiler, that’s preventing subclasses from adopting conformance.

If you do this in a playground:

> import Cocoa
> extension NSControl : NSValidatedUserInterfaceItem { }


You get these error messages (plus more for ’tag’):

> error: type 'NSControl' does not conform to protocol 'NSValidatedUserInterfaceItem'
> extension NSControl : NSValidatedUserInterfaceItem
>
> AppKit.NSValidatedUserInterfaceItem:2:17: note: protocol requires function 'action()' with type '() -> Selector'
>     public func action() -> Selector
>
> AppKit.NSControl:4:16: note: candidate is not a function
>     public var action: Selector { get set }

That pretty much lays out what the problem is, and as Luc

_______________________________________________

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: 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>)
 >Re: Validating NSButton in Swift (From: Roland King <email@hidden>)
 >Re: Validating NSButton in Swift (From: Quincey Morris <email@hidden>)
 >Re: Validating NSButton in Swift (From: 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