title: Swift: Type 'ViewController' does not conform to protocol 'UIPageViewControllerDataSource'
body: <p>I'm using Xcode 6 GM. I'm attempting to implement this <a href="http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/">page view controller tutorial</a> but in Swift instead of Objective-C but it's not working as expected. </p>
  
  <p>I've actually managed to find a <a href="https://github.com/akramhussein/Swift-Example-UIPageViewController">git repo</a> where someone else is doing the same, but after cloning their project and opening it in Xcode, it has the same errors I'm getting. I've managed to resolve most of them except for the protocol conformance issue when implementing the UIPageViewControllerDataSource protocol. </p>
  
  <p>To be honest, I don't completely understand the usage of <code>?</code> and <code>!</code> in Swift and if that's causing my issue. Removing the ! from the variables in the implementation of the protocol's methods causes other errors.</p>
  
  <p>Could someone please assist?</p>
  
  <pre><code>class ViewController: UIViewController, UIPageViewControllerDataSource {
  
  var pageViewController : UIPageViewController?
  var pageTitles = ["Over 200 Tips and Tricks", "Discover Hidden Features", "Bookmark Favorite Tip", "FreeRegular Update"]
  var pageImages = ["page1.png", "page2.png", "page3.png", "page4.png"]
  var currentIndex = 0
  
  @IBAction func startWalkthrough(sender: UIButton) {
      var startingViewController : PageContentViewController = self.viewControllerAtIndex(0)!
      var viewControllers : NSArray = [startingViewController]
      self.pageViewController!.setViewControllers(viewControllers, direction: .Forward, animated: false, completion: nil)
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      //Create page view controller
      self.pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil)
      self.pageViewController!.dataSource = self
  
      let startingViewController : PageContentViewController = self.viewControllerAtIndex(0)!
      let viewControllers: NSArray = [startingViewController]
      self.pageViewController!.setViewControllers(viewControllers, direction: .Forward, animated: false, completion: nil)
  
      // Change the size of page view controller
      self.pageViewController!.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 30);
  
      self.addChildViewController(self.pageViewController!)
      self.view.addSubview(self.pageViewController!.view)
      self.pageViewController!.didMoveToParentViewController(self)
  
  }
  
  func pageViewController(pageViewController: UIPageViewController!,
      viewControllerBeforeViewController viewController: UIViewController!) -&gt; UIViewController! {
  
          var index = (viewController as PageContentViewController).pageIndex
  
          if index == 0 || index == NSNotFound {
              return nil
          }
  
          index!--
  
          println("Decreasing Index: \(index)")
  
          return self.viewControllerAtIndex(index!)
  }
  
  func pageViewController(pageViewController: UIPageViewController!,
      viewControllerAfterViewController viewController: UIViewController!) -&gt; UIViewController! {
  
          var index = (viewController as PageContentViewController).pageIndex
  
          if index == NSNotFound {
              return nil
          }
  
          index!++
  
          println("Increasing Index: \(index)")
  
          if index == self.pageTitles.count {
              return nil;
          }
          return self.viewControllerAtIndex(index!);
  }
  
  func viewControllerAtIndex(index : Int) -&gt; PageContentViewController? {
  
      if self.pageTitles.count == 0 || index &gt;= self.pageTitles.count {
          return nil;
      }
  
      // Create a new view controller and pass suitable data.
      let pageContentViewController = self.storyboard!.instantiateViewControllerWithIdentifier("PageContentViewController") as PageContentViewController
      pageContentViewController.imageFile = self.pageImages[index]
      pageContentViewController.titleText = self.pageTitles[index]
      pageContentViewController.pageIndex = index
  
      return pageContentViewController;
  }
  
  func presentationCountForPageViewController(pageViewController: UIPageViewController) -&gt; Int {
      return self.pageTitles.count
  }
  
  func presentationIndexForPageViewController(pageViewController: UIPageViewController) -&gt; Int {
      return 0
  }
  }
  </code></pre>