I'm trying to using protocols to give certain specifications to structs that will implement them, but I need to be able to make these generic.
For example:
protocol NodeType {
}
protocol EdgeType {
var fromNode: NodeType
var toNode: NodeType
}
The problem is that both node could be different structs type that implement that implement the protocol NodeType
In a perfect world I would need this:
protocol EdgeType<T: NodeType> {
var fromNode: T
var toNode: T
}
to make sure that both nodes are the same class or struct type
Is something like this possible currently in swift? Thanks in advance