[swift-evolution] Specify type of a delegate which conforms to a protocol
Alex Hoppen
alex at ateamer.de
Tue Feb 9 12:29:51 CST 2016
At the moment you can achieve the same effect using the following construction (at least that’s what I used):
protocol UIViewControllerProtocol {} // Make sure only UIViewController conforms to this protocol
extension UIViewController: UIViewControllerProtocol {}
protocol MyProtocol {}
let myVar: protocol<UIViewControllerProtocol, MyProtocol>
It’s obviously far longer and less obvious but I hope it at least solves your issue for now.
- Alex
> On 09 Feb 2016, at 15:58, Inder Kumar Rathore . via swift-evolution <swift-evolution at swift.org> wrote:
>
> Hi All,
> I used to do this in Obj-C but I'm unable to do this in swift
>
> UIViewController<MyProtocol> *delegate;
>
> I posted this question on dev forums but didn't get the solution and finally I'm reporting here so that It can be added as a features in the coming releases.
>
> Thanks
>
> Rathore
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160209/0941a804/attachment.html>
More information about the swift-evolution
mailing list