title: Set timer to UIPageViewController
body: <p>I'm trying to have the <code>UIPageViewController</code> navigate through the pages for every 5 seconds. How to do this in Swift?</p>
  
  <p>Is there any way to explicitly call <code>viewControllerAfterViewController</code>?</p>
  
  <pre><code> var timer = NSTimer.scheduledTimerWithTimeInterval(5, target: self, selector: Selector("update"), userInfo: nil, repeats: true)
  
    func update() -&gt; UIViewController  {
                // can u please tell me what to add here 
      }
  
  
  
  func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -&gt; UIViewController?
  {
  
      var index = (viewController as tourViewControllerhelper).pageIndex
  
      if (index == 0) || (index == NSNotFound) {
           return viewControllerAtIndex(4)
      }
  
      index--
      pageCounter--
      return viewControllerAtIndex(index)
  }
  
  func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -&gt; UIViewController?
  {
  
      var index = (viewController as tourViewControllerhelper).pageIndex
  
      if (index == NSNotFound || index == 4) {
          return viewControllerAtIndex(0)
      }
  
      index++
      pageCounter++
  
      return viewControllerAtIndex(index)
  }
  func viewControllerAtIndex(index: Int) -&gt; tourViewControllerhelper?
  {
      if self.pageTitles == 0 || index &gt;= self.pageTitles
      {
          return nil
      }
  
  
      // Create a new view controller and pass suitable data.
      let pageContentViewController = tourViewControllerhelper()
  
      pageContentViewController.titleText = tourTextDescription[index]
      pageContentViewController.pageIndex = index
      currentIndex = index
  
      println("xyz")
      return pageContentViewController
  }
  </code></pre>