title: Swift 4 - How to get bounds of a UIView after Using Constraints Programatically
body: <p>I really need your help about this issue. I am creating a UIView object programatically without setting the bounds at the beggining. After creating I add constraints to that view in order to fit the required place in the screen. </p>
  
  <p>But the problem is that, I want to use that UIView's bounds property in the following parts of the code but unfortunately I can not get the bounds after constraints sets as it shows on the screen. </p>
  
  <p>Below I have sample code :</p>
  
  <pre><code>     let previewView = UIView()
  
       NSLayoutConstraint(item: previewView, attribute: .top, relatedBy: .equal, toItem: upperView, attribute: .bottom, multiplier: 1.0, constant: 0.0).isActive = true
  
       NSLayoutConstraint(item: previewView, attribute: .bottom, relatedBy: .equal, toItem: self.view, attribute: .bottom, multiplier: 1.0, constant: 0.0).isActive = true
  
  
      previewView.widthAnchor.constraint(equalToConstant: self.view.frame.width).isActive = true
  
      previewView.translatesAutoresizingMaskIntoConstraints = false
  
  
      print(previewView.bounds)
     // (0.0, 0.0, 0.0, 0.0) -&gt;&gt;&gt;&gt; How can I get the bounds as it shows on the screen instead of 0,0,0,0
  </code></pre>
  
  <hr>
  
  <p>After this point, when I try to use, previewView.bounds property, it returns me its original size as 0. </p>
  
  <p>How can I get the bounds as it shows on the screen with the related constaints' setup ? </p>
  
  <p>Thank you very much Guys.</p>