Hi Evolution,

We talked a while back about being able to get a list of all concrete 
implementations for a protocol (i.e. all the types that adhere to it).  Is this 
still being planned?

There are a couple of big use-cases for this:

• The first is for plug-ins and other things that require registration. A 
protocol can provide a way for them to be auto-registered by calling a static 
method from the protocol on each of them.

• The second is that you can build robust + extensible factories. 


I definitely have use for this right now.  I am currently writing a UI 
generator that auto-generates functioning UI based on a given set of 
criteria/data.  Right now, I have to manually register each partial-template 
(of which there will eventually be several thousand) with the factory by hand, 
which is an error-prone process. It is one of those things that was doable in 
ObjC pretty easily, but I still haven’t figured out how to do it in Swift.

Thanks,
Jon

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to