title: How to keep UIButton floating AFTER scrollViewDidScroll(_ scrollView: UIScrollView) reached bottom?
body: <p><img src="https://i.stack.imgur.com/0DHwU.gif" alt="Current implementation of floating button"></p>
  
  <p>The following is the current implementation. The grey button is floating on the scroll view. Is there a way to make the button appear once the yellow view (end of scroll view) is reached. Then keep it floating on the screen at the very bottom.</p>
  
  <p>I'm using the following code:</p>
  
  <pre><code>override func scrollViewDidScroll(scrollView: UIScrollView) {
  
  if (scrollView.contentOffset.y &gt;= (scrollView.contentSize.height - scrollView.frame.size.height)) {
      //reached bottom - how to show button below yellow
      // and keep it floating as shown above
  }
  }
  </code></pre>
  
  <p>Adding additional code of what I've tried so far:</p>
  
  <pre><code>    @IBOutlet weak var btnScroll: UIButton!
  
  var startingFrame : CGRect!
  var endingFrame : CGRect!
  
  func scrollViewDidScroll(_ scrollView: UIScrollView) {
      if (scrollView.contentOffset.y &gt;= (scrollView.contentSize.height - scrollView.frame.size.height)) &amp;&amp; self.btnScroll.isHidden {
          self.btnScroll.isHidden = false
          self.btnScroll.frame = startingFrame // outside of screen somewhere in bottom
          UIView.animate(withDuration: 1.0) {
              self.btnScroll.frame = self.endingFrame // where it should be placed
          }
      }
  }
  
  func configureSizes() {
      let screenSize = UIScreen.main.bounds
      let screenWidth = screenSize.width
      let screenHeight = screenSize.height
  
      startingFrame = CGRect(x: 0, y: screenHeight+100, width: screenWidth, height: 100)
      endingFrame = CGRect(x: 0, y: screenHeight-100, width: screenWidth, height: 100)
  
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      configureSizes()
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/PQ4pT.png" alt="Latest image shown like this. Button is constant and doesn&#39;t move"></p>