I'm trying to implement a protocol that is restricted to UIViewControllers. I have a struct that has an array of this protocol, and it isn't able to infer Hashable even though it is able to infer Hashable if the array type is just UIViewController. Here's an example...
protocol CardController where Self: UIViewController {
func update()
}
struct CardGroup: Hashable { // DOES NOT WORK (NOT HASHABLE)
let controllers: [CardController]
}
struct CardGroup: Hashable { // DOES WORK
let controllers: [UIViewController]
}
I have been unable to determine why my CardGroup cannot auto synthesize Hashable for CardController if CardController is a UIViewController.
I have a solution that works in my case that works and actually makes more sense for me. However, just from a learning angle, I don't see why this doesn't work. Is this a TODO with the Swift compiler? A feature that may not have been implemented yet?