title: how can I expandable a view in swift
body: <p>Im new in swift. In android, I using fragment to add or remove childview from parent view. I would like to expand an view when I switch a switch to on, and to collapse when I switch the switch to off. At the same time all the other elements I have in my design have to move down or up.</p>
  
  <p>And I dont want to use Expandable table view.</p>
  
  <p>Here is how the layout looks like when the switches are OFF
  <a href="https://i.stack.imgur.com/hMoFF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hMoFF.png" alt="enter image description here"></a></p>
  
  <p>And here is how the layout looks like when the switches are ON:
  <a href="https://i.stack.imgur.com/SSHOu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SSHOu.png" alt="enter image description here"></a></p>
  
  <p>I dont know how to make it, please help me.</p>
  
  <p>I change height of collection view to 0, but position of other under view not change.</p>
  
  <pre><code>UIView.animateWithDuration(0.3, delay: 0.0, options:UIViewAnimationOptions.TransitionNone, animations: { () -&gt; Void in
  
          if(!self.temp)
          {
              self.collection_seat.frame.size.height = 0
              self.temp = true
          }
          else
          {
  
              self.collection_seat.frame.size.height = 128
  
              self.temp = false
          }
          }, completion: { (finished: Bool) -&gt; Void in
  
      })
  </code></pre>