title: Get UIView height and use it for its own constraints
body: <p>How can I can the <code>height</code> of my <code>UIView</code> before it is actually presented?</p>
  
  <p>This is what I tried: </p>
  
  <pre><code>print(wishWishView.frame.size.height)
  
  self.view.addSubview(self.wishWishView)
  
  wishWishView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor).isActive = true
  wishWishView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor).isActive = true
  
  wishWishConstraint =  wishWishView.topAnchor.constraint(equalTo: self.view.bottomAnchor)
  wishWishConstraint.isActive = true
  
  UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1.0, initialSpringVelocity: 1.0, options: .curveEaseInOut, animations: {
          self.transparentView.alpha = 0.7
          self.wishWishConstraint = self.wishWishView.topAnchor.constraint(equalTo: self.view.bottomAnchor, constant: - self.keyboardHeight)
          self.view.layoutIfNeeded()
  
      }, completion: nil)
  </code></pre>
  
  <p>The problem is that <code>wishWishView.frame.size.height</code> is <code>0</code> until the view is actually presented.</p>
  
  <p>What I actually want to achieve is to hide the view at the bottom. I know I could just use <code>constant: 1000</code> but that's quite brute force and not very clean.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Process:</p>
  
  <p><strong>1.</strong> user taps on button</p>
  
  <p><strong>2.</strong> view appears from the bottom to right above the kayboard</p>
  
  <p><strong>3.</strong> user dismisses the view</p>
  
  <p><strong>4.</strong> view moves to the bottom out of the view</p>
  
  <p><a href="https://gofile.io/?c=12J4CD" rel="nofollow noreferrer">Animation</a></p>
  
  <p>I have all the <code>functions</code> and <code>variables</code> (<code>func viewAppears</code>, <code>keyboardHeight</code>,...), but I am struggling with the <code>constraints</code>.</p>