I have been enjoying the benefits of extended protocol support in Swift 2.x. Upon it's introduction, I was hoping that you could use protocols as facades to isolate separate domains in an application. For example, in the MVC pattern, it would be nice to present a data-backed object to a view as a view model, augmented with any required derivative properties
Alas, this does not seem to be supported. I wanted to present the problem and get input on the viability of such functionality.
Consider the following simplified example. It is possible to deduce that FooModel does semantically satisfy the FooViewModel protocol since it's member bar:BarModel, implements BarViewModel, but it appears that the compiler is not making that leap. Is this possible, planned, and / or somehow dangerous?
struct BarModel {}
struct FooModel { var bar:BarModel }
protocol BarViewModel {}
extension BarModel : BarViewModel {}
protocol FooViewModel { var bar:BarViewModel { get } }
extension FooModel : FooViewModel {} // complains that bar:BarModel is not BarViewModel
Thanks