title: Swift - UIPinchGestureRecognizer in UIPageViewController
body: <p>Okay, I've created a pageview slider app. Everything works great, but now I'd like to be able to Pinch In/Out of my UIPageViewController using UIPinchGestureRecognizer.</p>
  
  <p>I have everything set up in code, but I still get this ERROR when I pinch.</p>
  
  <pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException',
  reason: '-[App.ViewController pinchDetected]: unrecognized selector sent 
  to instance 0x7faadc90c6f0'
  </code></pre>
  
  <p><strong>How can I use my pinchDetected function in the UIPageViewController using UIPinchGestureRecognizer?</strong> </p>
  
  <p>Please let me now if I am doing this wrong.
  New to swift/ios</p>
  
  <p><strong>my code</strong></p>
  
  <pre><code>class ViewController: UIViewController, UIPageViewControllerDataSource {
  
  var pageViewController: UIPageViewController!
  
  private var allPages = [Page]()
  var pages = NSMutableOrderedSet()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      ###PinchRecognizer
      var pinchRecognizer = UIPinchGestureRecognizer(target:self, action:"pinchDetected")
      self.view.addGestureRecognizer(pinchRecognizer)
  
      self.pageViewController = self.storyboard?.instantiateViewControllerWithIdentifier("PageViewController") as! UIPageViewController
      self.pageViewController.dataSource = self
  
      var startVC = self.viewControllerAtIndex(0) as ContentViewController
      var viewControllers = NSArray(object: startVC)
      self.pageViewController.setViewControllers(viewControllers as [AnyObject], direction: .Forward, animated: true, completion: nil)
  
      self.pageViewController.view.frame = CGRectMake(0, 30, self.view.frame.width, self.view.frame.size.height)
  
      self.addChildViewController(self.pageViewController)
      self.view.addSubview(self.pageViewController.view)
      self.pageViewController.didMoveToParentViewController(self)
  }
  
  ###PinchRecognizer Function
  func pinchDetected(pinchRecognizer: UIPinchGestureRecognizer) {
      var scale: CGFloat = pinchRecognizer.scale;
      self.view.transform = CGAffineTransformScale(self.view.transform, scale, scale);
      pinchRecognizer.scale = 1.0;
  }
  
  func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -&gt; UIViewController? {
      var vc = viewController as! ContentViewController
      var index = vc.pageIndex as Int
  
      if (index == 0 || index == NSNotFound) {
          return nil
      }
  
      index--
      return self.viewControllerAtIndex(index)
  }
  
  func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -&gt; UIViewController? {
  
      var vc = viewController as! ContentViewController
      var index = vc.pageIndex as Int
  
      if (index == NSNotFound) {
          return nil
      }
  
      index++
  
      if (index == self.pages.count) {
          return nil
      }
  
      return self.viewControllerAtIndex(index)
  
  }
  
  func viewControllerAtIndex(index: Int) -&gt; ContentViewController
  {
      if ((self.pages.count == 0) || (index &gt;= self.pages.count)) {
          return ContentViewController()
      }
  
      var vc: ContentViewController = self.storyboard?.instantiateViewControllerWithIdentifier("ContentViewController") as! ContentViewController
  
      ###Store image in imageFile
      var image = (pages.objectAtIndex(index) as! Page).image        
      vc.imageFile = image
      vc.pageIndex = index
  
      return vc
  
  }
  
  func presentationCountForPageViewController(pageViewController: UIPageViewController) -&gt; Int
  {
      return self.pages.count
  }
  
  func presentationIndexForPageViewController(pageViewController: UIPageViewController) -&gt; Int
  {
      return 0
  }
  
  } 
  </code></pre>