Re: [swift-users] Generic inheritance with where clause

2017-08-29 Thread somu subscribe via swift-users
Hi Nikita, See if the below implementation fits your needs: protocol P1 {} protocol P2 : P1 where T : P1 { associatedtype T var input : T { get } } struct S1 : P1 {} struct S2 : P2 { typealias T = S1 var input: T } Regards, Muthu > On 30 Aug 2017, at 1:25

[swift-users] Generic inheritance with where clause

2017-08-29 Thread Nikita Leonov via swift-users
Hello everyone, I am looking a way to express something similar to the following code in Swift terms: protocol AnyViewModelInput {} protocol AnyViewModel: ViewModelInput where ViewModelInput: AnyViewModelInput { var input: ViewModelInput { get } } Is it possible in current Swift? Will it be p

[swift-users] Generic inheritance with where clause

2017-08-29 Thread Nikita Leonov via swift-users
Hello everyone, I am looking a way to express something similar to the following code in Swift terms: protocol AnyViewModelInput {} protocol AnyViewModel: ViewModelInput where ViewModelInput: AnyViewModelInput { var input: ViewModelInput { get } } Such construct supposed to avoid code duplica