title: How do I give users the ability to swipe through an array of images in swift?
body: <p>I'm currently using a combination of UISwipeGestureRecognisers and an array of images but this isn't giving me the desired effect. When I swipe the image just appears but what I'm aiming for is a horizontal scrolling effect.</p>
  
  <p>So for example if I partially scroll to the left, both the image I'm scrolling away from and the image I'm scrolling to will be on screen. I'm sure this can be achieved with a horizontal UIScrollView but not sure how to do this.</p>
  
  <p>This is what I'm doing now.</p>
  
  <p><strong>My images are loaded from parse and stored in a imagesArray:</strong></p>
  
  <pre><code>    query.findObjectsInBackgroundWithBlock { (objects: Array!, error: NSError!) -&gt; Void in
  
          if error != nil {
              println("0 images found")
          } else {
  
  
              self.imagesArray.addObjectsFromArray(objects)
  </code></pre>
  
  <p><strong>Set up the gesture recogniser in my viewDidload:</strong></p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      var rightSwipe = UISwipeGestureRecognizer(target: self, action: "didSwipe:")
      userImage.addGestureRecognizer(rightSwipe)
  
      var leftSwipe = UISwipeGestureRecognizer(target: self, action: "didSwipe:")
  
      leftSwipe.direction = UISwipeGestureRecognizerDirection.Left
      userImage.addGestureRecognizer(leftSwipe)
  }
  </code></pre>
  
  <p><strong>My didSwipe method:</strong></p>
  
  <pre><code>func didSwipe(sender: UISwipeGestureRecognizer) {
      var direction = sender.direction as UISwipeGestureRecognizerDirection
  
      switch (direction) {
      case UISwipeGestureRecognizerDirection.Right:
          println("swiped right")
  
      case UISwipeGestureRecognizerDirection.Left:
          println("swiped left")
          println(imagesArray)
          userImage.file = imagesArray.objectAtIndex(1)["image"] as PFFile
          userImage.loadInBackground()
      default:
          println("ok")
  
      }
  
  
  }
  </code></pre>