     super.viewDidLoad()
 
     self.tableView.dataSource = self.dataSource
-
-    self.refreshControl = UIRefreshControl()
-    self.refreshControl!.addTarget(self, action: #selector(self.tableViewPulledToRefresh(_:)), forControlEvents: .ValueChanged)
-  }
-
-  func tableViewPulledToRefresh(refreshControl: UIRefreshControl) {
-    self.refreshTimer?.invalidate()
-
-    // Simulating data loading, 10 secs to be sure that there's enough time to Reveal the view before it ends
-    self.refreshTimer = NSTimer.scheduledTimerWithTimeInterval(10, target: self, selector: #selector(self.didLoadDummyData(_:)), userInfo: nil, repeats: false)
-  }
-
-  func didLoadDummyData(timer: NSTimer) {
-    self.refreshControl?.endRefreshing()
+    
+    self.setupRefreshControl()
   }
 
   private static func footerLabelWithText(text: String?) -> UILabel {

//
//  Copyright © 2015 Itty Bitty Apps. All rights reserved.

import UIKit

final class CountriesViewController: RevertTableViewController {
  private let collection = CollectableCollection<Country>(items: .CountriesCapitals)
  private let dataSource: DataSource<Country, BasicCell>
  private var refreshTimer: NSTimer?

// MARK:- UITableViewDelegate
extension CountriesViewController {
  override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    let cell = tableView.cellForRowAtIndexPath(indexPath)
    if cell?.accessoryType == .Checkmark {
      cell?.accessoryType = .None
    } else {
      cell?.accessoryType = .Checkmark
    }
    
    tableView.deselectRowAtIndexPath(indexPath, animated: true)
  }

