I have an @objc
protocol with this implementation:
@objc public protocol Document: class {
var data: Data? { get }
var image: UIImage? { get }
func generatePreview()
}
And I'm trying to use it in a [Document: Int]
dictionary, but naturally I get this error:
Type 'Document' does not conform to protocol 'Hashable'
The problem is that I don't know how to make it conform Hashable
, since it is an @objc
protocol and Hashable
is only available in Swift. If I try to make it conform Hashable
, I get this error:
@objc protocol 'Document' cannot refine non-@objc protocol 'Hashable'
This protocol is used as a property in an @objc
method, which I want to keep as an '@objc' method since it is part of a @objc
delegate protocol.
This protocol looks like this:
@objc public protocol MyClassDelegate: class {
@objc func methodOne(parameter: [Document: Int])
}
Any idea?
@objc
? – Ahmad F@objc
method – kikettas@objc
methods you may just useNSDictionary
. – user28434'mstep@objc
; it's protocols and Hashable. – Rob Napier