[swift-evolution] AnyProtocol proposal
joao3001 at hotmail.com
Wed Feb 17 13:37:59 CST 2016
The code is for a delegate. Thus it needs a protocol not a class.
If you use a class and not a protocol, your delegate wont be able to subclass any other class to implement the "protocol" because it is a class.
The same applies if the uitableview delegate was declared as a class. You couldn't subclass a viewcontroller and still conform to the tableview delegate protocol.
Sent from my iPhone
> On 17 Feb 2016, at 21:12, Sune Foldager <cyano at me.com> wrote:
>> On 17 Feb 2016, at 18:59, João Nunes via swift-evolution <swift-evolution at swift.org> wrote:
>> In the example given. How would you restrict the generic type to a protocol without the use of AnyProtocol ?
> But what would you gain from restricting to just protocols? What could go wrong if someone passed in a class?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution