Swift 2 how to expand and collapse a view?
<p>I have scrollView in which if there is no data, I need to hide (collapse the space occupied by it) so that the lower view can come upwards.</p>

<p>I tried this code with no luck. Please help me.</p>

<pre><code>if(dataForScroll==0){

       var   newFrame:CGRect = self.myScroll.frame;

   newFrame.size.height = 0;
   self.myScroll.frame = newFrame



           }
</code></pre>