Generic Protocols with Associated Type
Bob Lee
48912

Hi! I’m designing a data manager for my Core Data model and I’d like to create a generic function to fetch relatives of a class.

I’ve created a protocol allowing to build managers for each data type. In this protocol, I already defined two associated types T and K and several simple functions. Now I’m stuck with a class relatives fetching method — I need to indicate somehow that T has K relatives. I’ve tried in vain to create some protocol indicating this relationship thru mutual properties so both classes could conform to this protocol. Any idea, is it even possible? Here — https://stackoverflow.com/questions/45962935/get-core-data-entity-relatives-with-a-generic-function — you can see my example with the same question.