I am wondering what is wrong with the following code ?
import Foundation
enum SliderType: Int {
case analog = 1, discrete, highLow
}
protocol DataEntry: class, Hashable {
var hashValue: Int { get set } // hashable protocol requires this
var idx: Int { get set }
var category: String { get set }
var sliderType: SliderType { get set }
var sliderTitle: String { get set }
var sliderCurrentValue: Float { get set }
var sliderMinValue: Float { get set }
var sliderMaxValue: Float { get set }
}
func ==(lhs: DataEntry, rhs: DataEntry) -> Bool {
return lhs.idx == rhs.idx
}
As can be seen in this screenshot, I keep getting the error Protocol 'DataEntry' can only be used as a generic constraint because it has Self or associated type requirements
Does anybody know what might be wrong here ?? How do you implement a Hashable protocol to a protocol ?