 fileprivate extension StretchableHeaderView {
     
     func isStretching(in scrollView: UIScrollView) -> Bool {
-        return scrollView.contentOffset.y < -baseHeight
+        return scrollView.contentOffset.y < -initialHeight
     }
     
     func getNewFrame(in scrollView: UIScrollView) -> CGRect {
         let width = scrollView.bounds.width
-        var rect = CGRect(x: 0, y: -baseHeight, width: width, height: baseHeight)
+        var rect = CGRect(x: 0, y: -initialHeight, width: width, height: initialHeight)
         guard isStretching(in: scrollView) else { return rect }
         rect.origin.y = scrollView.contentOffset.y
         rect.size.height = -scrollView.contentOffset.y
         return rect
     }
-    
-    func setup() {
-        clipsToBounds = true
-        baseHeight = frame.size.height
-    }
 }

    
    // MARK: - Properties
    
    fileprivate var baseHeight: CGFloat!
    
    
    
    // MARK: - Public Functions
    
    open func handleScroll(in scrollView: UIScrollView) {
        frame = getNewFrame(in: scrollView)
    }
    
    open func setup(in tableView: UITableView?) {
        guard let tableView = tableView else { return }
        guard self == tableView.tableHeaderView else { return }
        let height = frame.size.height


/*
 
 This view is stretched out when the user drags a scroll
 view (e.g. table view) in the negative scroll direction.
 
 To use this view with a table view, first add it as the
 table header view, then call handleScroll(in:) whenever
 scrollViewDidScroll(:) is triggered.
 
 */

import UIKit


open class StretchableHeaderView: UIView {

    
    // MARK: - View Lifecycle
    
    open override func layoutSubviews() {
        super.layoutSubviews()
