title: How to use generics for ViewModel in Kotlin?
body: <p>I want to create a MainFragment for my existing  fragments and create a ViewModel object for each fragment that is provided <code>by viewModels&lt;FragmentName::class&gt;()</code> like this:</p>
  <pre><code>class MainFragment&lt;VM: ViewModel&gt;: Fragment() {
      private val viewModel by viewModels&lt;VM::class&gt;()
  }
  </code></pre>
  <p>But I get this error:</p>
  <pre><code>Cannot use 'VM' as reified type parameter. Use a class instead.
  </code></pre>
  <p>This is what I want to have:</p>
  <pre><code>class ProfileFragment: MainFragment&lt;ProfileViewModel&gt;() {}
  </code></pre>
  <p>And simply use viewModel object from the parent class.</p>
  <p>How to solve this?</p>