I am working with Swift 2.0 and I have a hierarchy of protocols with this layout.
protocol Root {
var parent: Self? { get }
}
func == <T: Main> (left: T, right: T) -> Bool {
return left.item.text == right.item.text
}
protocol Main: Root {
var item: Item { get set }
}
protocol Item: Root {
var text: String { get set }
}The problem I have is that on line 10 var item: Item { get set } I get the error "Protocol 'Item' can only be used as a generic constraint because it has Self or associated type requirements." I can't seem to figure out how to write line 10 to be rid of the error. I tried using a typealias to set a placeholder on line 10 and then line 6 of the infix function return left.item.text == right.item.text throws an error because it doesn't know what type the item variable is. I can't seem to figure out how to define the "item" variable since it inherits from Root just as Main does. Am I missing something? Any help is greatly appreciated.