Consider the following:
import Cocoa
protocol Mark {}
protocol Detector: class {
func check<M: Mark>(mark: M)
}
enum ColorTint: Mark {
case red, green, blue
}
class Vision: Detector { // Error: type does not conform to protocol
func check(mark: ColorTint) {
switch mark {
case .red:
print("I see reddish")
case .green:
print("I see greenish")
case .blue:
print("I see blueish")
}
}
}
I have two protocols, one of which has generic function with parameter constrained to another protocol. In the result I cannot make a type conformant to the protocol with the generic function. Is it even possible?