title: How to shrink array in swift
body: <p>Array in swift can grow dynamically according to the size, but it does not seem to be shrinking.</p>
  
  <pre><code>var x: [Int] = []
  for i in 0...1000 {
      x.append(i)
  }
  for i in reverse(1000...0) {
      x.removeAtIndex(0)
  }
  </code></pre>
  
  <p>The capacity of <code>x</code> remains large. I also tried <code>removeLast()</code> and copy it to a new variable, but does not seem to reduce the capacity.</p>