[swift-users] Generic inheritance with where clause

Nikita Leonov nikita.leonov at gmail.com
Tue Aug 29 01:19:38 CDT 2017


Hello everyone,

I am looking a way to express something similar to the following code in
Swift terms:
protocol AnyViewModelInput {}
protocol AnyViewModel<ViewModelInput>: ViewModelInput where ViewModelInput:
AnyViewModelInput {
    var input: ViewModelInput { get }
}

Is it possible in current Swift? Will it be possible if generic
manifesto will be implemented in full? Also if you know how to express a
similar idea in any other language, I would love to see examples. How does
such construct is named in other languages?

Thank in advance,
Nikita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170828/29e562f0/attachment.html>


More information about the swift-users mailing list