title: How to return an inout (reference) in a swift function?
body: <p>I'd like a function to return a reference of an array:</p>
  
  <pre><code>var a = [1, 2]
  var b = [3, 4]
  
  func arrayToPick(i:Int) -&gt; [Int] {
      return i == 0 ? a : b
  }
  
  inout var d = arrayToPick(0)
  d[0] = 6
  
  println(a[0]) // 1
  println(d[0]) // 6
  </code></pre>
  
  <p>I'm unable to return <code>&amp;a</code> or <code>&amp;b</code> in <code>arrayToPick</code> because those can't be casted to <code>[Int]</code>.</p>
  
  <p>How to return a reference on <code>a</code> or <code>b</code> from a function?</p>