title: How to remove all subviews of a view in Swift?
body: <p>I'm looking for a simple method to remove at once all subviews from a superview instead of removing them one by one.</p>
  
  <pre><code>//I'm trying something like this, but is not working
  let theSubviews : Array = container_view.subviews
  for (view : NSView) in theSubviews {
      view.removeFromSuperview(container_view)
  }
  </code></pre>
  
  <p>What I am missing?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>My app has a main <code>container_view</code>. I have to add different other views as subviews to <code>container_view</code> in order to provide a sort of navigation.</p>
  
  <p>So, when clicking the button to "open" a particular page, I need to remove allsubviews and add the new one.</p>
  
  <p><strong>UPDATE 2 - A working solution (OS X)</strong></p>
  
  <p>I guess Apple fixed it.</p>
  
  <p>Now it is more easy than ever, just call: </p>
  
  <pre><code>for view in containerView.subviews{
      view.removeFromSuperview()
  }
  </code></pre>