title: Generic View SwiftUI with ViewModel
body: <p>I'm looking for a solution with View and polymorphism. I'v a a protocol with a special ViewModel
  like that: </p>
  
  <pre><code>protocol PQuestionView: View {
      associatedtype VM where VM : BaseQuestionViewModel
      var vm: Self.VM { get }
  }
  
  </code></pre>
  
  <p>so I can use it in a struct like that:</p>
  
  <pre><code>struct test: PQuestionView {
      var vm:YesNoQuestionViewModel = YesNoQuestionViewModel(question: Question(), temporaryId: 3)
      var body: some View{
          VStack{
              Text("Yes")
          }
      }
  }
  </code></pre>
  
  <p>I want to have an array of PQuestionView:</p>
  
  <pre><code>var questionViews: [PQuestionView]
  </code></pre>
  
  <p>But I have two associated types, it seems that way of implementing view doesn't work as polymorphism. So I tried something like that:</p>
  
  <pre><code>struct StrongView&lt;MyView: View,VM: BaseQuestionViewModel&gt; : PQuestionView{
      var vm: VM
      var body: MyView
  }
  </code></pre>
  
  <p>But it's have a strongly typed struct and it doesn't answer to my genericity problem... Does a good solution exists to that job? </p>