[swift-evolution] [Manifesto] Completing Generics
plx
plxswift at icloud.com
Thu Mar 3 08:04:20 CST 2016
# Missing Idea: Protocols Restricted to Specific Classes
This has come up on the list somewhat often (cf the current abstract class thread).
The idea is being able to write the below:
// expectation is we are defining a protocol that can only be adopted by classes
// that are subclasses of `UIViewController`
protocol SpecializedViewController : UIViewController {
}
…the absence of which is something that *can* be worked-around today, but it’d be nice not to have to work around it (or to have it added to the “unlikely” category if there’s a deep reason this isn’t feasible).
Also, it’s possible that this *may* be addressed already (e.g. perhaps this is implicit in “generic typealiases”?).
More information about the swift-evolution
mailing list