When accessing types that conform to a protocol required by the generic.

This is why I sometimes find myself debating whether to use enums instead of protocols because specialization doesn’t work for presenting available types that conform to protocols.

For example let’s say there are 4 different types that conform to IsClassy in my project, and a method I want to use says that I can define a generic type so long as that generic type conforms to isClassy. I don’t happen to have those 4 types that conform to IsClassy memorized. It doesn’t seem outlandish for the compiler to be able to identify those 4 different types and suggest them to me, thereby saving the trip of seeking out every type that conforms to IsClassy.

1 Like