     
     public func stickFooter() {
         if let stickyView = tableFooterView {
-            let insets: UIEdgeInsets
-            if #available(iOS 11.0, *) {
-                insets = adjustedContentInset
-            } else {
-                insets = contentInset
-            }
-            stickyView.frame.origin.y = bounds.size.height + contentOffset.y - stickyView.bounds.size.height - insets.bottom
+            stickyView.frame.origin.y = bounds.size.height + contentOffset.y - stickyView.bounds.size.height - bestContentInset.bottom
             // Keep on top, so cells scroll underneath it:
             addSubview(stickyView)
         }


public extension Adjustable {
    
    public func stickHeader() {
        if let stickyView = tableHeaderView {
            stickyView.frame.origin.y = max(0, contentOffset.y - contentInset.top)
            // Keep on top, so cells scroll underneath it:
            addSubview(stickyView)
        }


/*
// Implement in a subclass of UITableView:

override func layoutSubviews() {
    super.layoutSubviews()
    stickHeader()
    stickFooter()
}

// Or set up toggle variables, such as in AdjustableTableView and also below:

@IBInspectable open var isStickyHeader: Bool = false
@IBInspectable open var isStickyFooter: Bool = false
