title: Initialize enum from associated value
body: <p>I would like to initialize enum by its associated value.</p>
  
  <p>My enum:</p>
  
  <pre><code>enum class DirectionSwiped(raw: Int){
      LEFT(4),
      RIGHT(8);
  }
  </code></pre>
  
  <p>I would like to initialize it as such:</p>
  
  <pre><code>val direction = DirectionSwiped(raw: 4)
  </code></pre>
  
  <p>But I get this error: </p>
  
  <blockquote>
    <p>Enum type cannot be instantiated</p>
  </blockquote>
  
  <p>Why is this happening? In Swift, this functionality works like this:</p>
  
  <pre><code>enum Direction: Int {
      case right = 2
  }
  
  let direction = Direction(rawValue: 2)
  </code></pre>
  
  <p>How can I make it work in Kotlin?</p>