Re: Validating NSButton in Swift
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