Currently, it is not possible to constrain an associated type to a non-protocol, non-class type. I'm wondering about the technical reason for this, do we need to have a witness/vtable for that type at some point? Otherwise structs/enums would just trivially satisfy the subtyping requirement…
1 Like
anandabits
(Matthew Johnson)
2
I pitched the feature you’re looking for a little over a year ago: [Pitch] Generalized supertype constraints. Maybe after Swift 5 ships there is a chance of someone working on an implementation. We’ll have to wait and see...
4 Likes
Anachron
(Markus Kasperczyk)
3
Anything new on this? This is one of my pet frustrations as well.