         }
     }
     func addPullToRefreshWithAnimator(animator: CustomPullToRefreshAnimator) {
-        tableView.addPullToRefresh(animator: animator, action: { [weak self] () -> Void in
+        tableView.addPullToRefresh(animator: animator, action: { [unowned self] () -> Void in
             DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
                 print("end refreshing")
-                self?.tableView?.endRefreshing()
+                
+                self.items += 3
+                self.tableView.reloadData()
+                self.tableView?.endRefreshing()
+                
+                if self.items < 12 {
+                    self.tableView.enableInfiniteScroll = false
+                } else {
+                    self.tableView.enableInfiniteScroll = true
+                }
             }
         })
     }

                self?.tableView?.endInfiniteScrolling()
            }
        })
    }

    override func didReceiveMemoryWarning() {

class AddSamplesTableViewController: UITableViewController {

    var type:AnimatorType = .Default
    var items = 5
    
    override func viewDidLoad() {
        super.viewDidLoad()
