 import NotificationCenter
 
 final class TodayViewController: UITableViewController, NCWidgetProviding {
+    let placeholderData = FavoriteStopViewModel(stopName: "Something's not right",
+        stopId: 0, distanceFromUser: "", isNearestStop: false,
+        firstRouteColor: UIColor.clearColor(), firstRouteName: "", firstRouteArrivals: "Tap to open the app.",
+        secondRouteColor: UIColor.clearColor(), secondRouteName: "", secondRouteArrivals: "")
+    
     var favoriteStops = [FavoriteStopViewModel]()
     var didCompleteUpdate = false
-    let placeholderData = [
-        FavoriteStopViewModel(stopName: "Something's not right", stopId: 0,
-            distanceFromUser: "", isNearestStop: false,
-            firstRouteColor: UIColor.clearColor(), firstRouteName: "", firstRouteArrivals: "Tap to open the app.",
-            secondRouteColor: UIColor.clearColor(), secondRouteName: "", secondRouteArrivals: "")
-    ]
     
     override func viewDidLoad() {
         super.viewDidLoad()

        let cell = tableView.dequeueReusableCellWithIdentifier("TodayTableViewCell") as! FavoriteStopTableViewCell
        
        cell.update(favoriteStops.isEmpty
            ? placeholderData[0]
            : favoriteStops[indexPath.row])
        
        return cell

    func clearTableIfUpdatePending() {
        if !didCompleteUpdate {
            favoriteStops = []
            NSUserDefaults.groupUserDefaults().cachedFavoriteStops = []
            tableView.reloadData()
        }
    }
