varpullUpDragging:Bool=falsevarpullDownDragging:Bool=falsevarstartOffset:CGFloat=0overridefuncviewDidLoad(){super.viewDidLoad()//...updateLabel=UILabel(frame:CGRectMake(productListTable.bounds.width/2-35,0,70,30))updateLabel.text="Loading..."updateLabel.textColor=UIColor(red:0.0,green:122.0/255.0,blue:1.0,alpha:1.0)updateLabel.hidden=trueself.productListTable.addSubview(updateLabel)self.productListTable.tableFooterView=updateLabel}funcscrollViewWillBeginDragging(scrollView:UIScrollView){startOffset=scrollView.contentOffset.y}funcscrollViewDidScroll(scrollView:UIScrollView){if(scrollView.contentOffset.y<0){pullDownDragging=true}}funcscrollViewDidEndDragging(scrollView:UIScrollView,willDeceleratedecelerate:Bool){if(startOffset+scrollView.frame.height>=scrollView.contentSize.height)&&!pullDownDragging{pullUpDragging=trueupdateLabel.hidden=false}}funcscrollViewDidEndDecelerating(scrollView:UIScrollView){ifpullUpDragging&&!waitForResponse{//To send request and refresh the data}pullUpDragging=falsepullDownDragging=falseupdateLabel.hidden=true}