ARSwipeToSelectGestureRecognizer 0.3

ARSwipeToSelectGestureRecognizer 0.3

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.

  • By
  • Andrew Ng and Ray Tsaihong



This is a UIGestureRecognizer subclass to enable Swipe-to-Select/Deselect with a UICollectionView.

Adding to your project

The easiest way to add ARSwipeToSelectGestureRecognizer to your project is via CocoaPods:

pod 'ARSwipeToSelectGestureRecognizer'

Alternatively you could copy all the files in the Classes/ directory into your project. Be sure 'Copy items to destination group's folder' is checked.


  1. Import the header: #import "ARSwipeToSelectGestureRecognizer.h"
  2. Create an instance of ARSwipeToSelectGestureRecognizer, pass in a block to handle toggling NSIndexPath

Instatiation, in your UICollectionViewController:

- (void)viewDidLoad
    [super viewDidLoad];
    self.collectionView.allowsSelection = self.collectionView.allowsMultipleSelection = YES;

    // Do any additional setup after loading the view.
    ARSwipeToSelectGestureRecognizer *gestureRecognizer = [[ARSwipeToSelectGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:) toggleSelectedHandler:^(NSIndexPath *indexPath) {
        if ([[self.collectionView indexPathsForSelectedItems] containsObject:indexPath]) {
            [self.collectionView deselectItemAtIndexPath:indexPath animated:NO];
            [self.collectionView cellForItemAtIndexPath:indexPath].alpha = 1.0;
        } else {
            [self.collectionView selectItemAtIndexPath:indexPath animated:NO scrollPosition:UICollectionViewScrollPositionNone];
            [self.collectionView cellForItemAtIndexPath:indexPath].alpha = 0.5;
    [self.collectionView addGestureRecognizer:gestureRecognizer];


Demo project

  • A demo application that uses ARSwipeToSelectGestureRecognizer to select multiple photos to share with UIActivityViewController can be found in the Demo folder.
  • ARSwipeToSelectPickerController is a UIImagePickerController-like assets picker that utilizes ARMultiSelectGestureRecognizer for swipe-to-select.


Bitdeli Badge