     }
   }
 
+  func selectDate(selectedDate: NSDate) {
+    // FIXME: this is a draft. Interface of scrollview should be changed
+    let centerDaySelector = pagingScrollView.reusableViews[1] as! DaySelector
+    let startDate = dateOnlyFromDate(centerDaySelector.startDate)
+
+    let dateRange = DTTimePeriod(size: .Week, startingAt: startDate)
+    if dateRange.containsDate(selectedDate, interval: .Open) {
+      let diff = selectedDate.daysFrom(startDate)
+      centerDaySelector.selectedIndex = diff
+    } else {
+      // TODO: Check for the direction of scrolling and reconfigure appropriate DatySelector
+    }
+  }
+
   override func layoutSubviews() {
     super.layoutSubviews()
     pagingScrollView.contentSize = CGSize(width: bounds.size.width * CGFloat(pagingScrollView.reusableViews.count), height: 0)

import UIKit

protocol DayHeaderViewDelegate: class {
  func dateHeaderDateChanged(newDate: NSDate)


  func scrollviewDidScrollToView(view: UIView) {
    let activeView = view as! DaySelector
    activeView.selectedIndex = currentWeekdayIndex
    swipeLabelView.date = activeView.selectedDate!
    delegate?.dateHeaderDateChanged(activeView.selectedDate!
    )
