title: Resize View height on didSelectItemAt Swift
body: <p>I have a iOS custom keyboard that incorporates SFSafariViewController when an item in a collection view is selected. The custom keyboard is the same height as a normal keyboard, but I would like to pop up the webview while it is in use. I am trying layout as needed, but not having any luck. What am I missing?
  Here is the function - Can post more</p>
  
  <p>func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {</p>
  
  <pre><code>    if(collectionView == self.key.colImages)
      {
          if (self.articles[indexPath.item].url) != nil{
              let sfViewController = SFSafariViewController(url: URL(string: (self.articles[indexPath.item].url!))!, entersReaderIfAvailable: true)
  
              //MARK: - sets background and text color for Safari
  
              if #available(iOS 10.0, *) {
                  sfViewController.preferredBarTintColor = .white
                  sfViewController.preferredControlTintColor = UIColor(red:0.19, green:0.58, blue:0.91, alpha:1.0)
              } else {
                  sfViewController.view.tintColor = .white
              }
              self.present(sfViewController, animated: true, completion: nil)
              sfViewController.delegate = self
  
              //MARK: - Copies url
              UIPasteboard.general.string = ((self.articles[indexPath.item].url!))
  
              //Trying to resize browser window
              self.heightConstraint.constant = 500.0
              self.view.layoutIfNeeded()
  
              UIView.animate(withDuration: Double(0.5), animations: {
                  self.heightConstraint.constant = 0
                  self.view.layoutIfNeeded()
              })
  
          }
  
           }
      else
      {
  
          self.fetchArticles(fromSource: "\(categoriesArray[indexPath.row])")
          //URLCache.shared.removeAllCachedResponses()
  
                  }
  
  }
  </code></pre>