Skip to content
A collection view subclass that enables swipe(finger over) to select multiple cells just like in Photos app.
Swift Ruby Objective-C
Branch: master
Clone or download
Pull request Compare This branch is 14 commits ahead, 7 commits behind ShaneQi:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Assets
Example
Sources
SwipeSelectingCollectionView.xcodeproj
SwipeSelectingCollectionView
.gitignore
.swift-version
LICENSE
Package.swift
README.md
SwipeSelectingCollectionView2.podspec

README.md

SwipeSelectingCollectionView2

A collection view subclass that enables swipe(finger over) to select multiple cells just like in Photos app.
This project is derived from SwipeSelectingCollectionView(https://github.com/ShaneQi/SwipeSelectingCollectionView)

Swift Version Swift Version

Requirements

  • Swift 4.2
  • iOS 9.0+
  • Xcode 10.1

Installation

CocoaPods

You can use CocoaPods to install SwipeSelectingCollectionView by adding it to your Podfile:

platform :ios, '11.0'
use_frameworks!
pod 'SwipeSelectingCollectionView2'

To get the full benefits import SwipeSelectingCollectionView2 wherever you import UIKit

import UIKit
import SwipeSelectingCollectionView2

Manually

  1. Download and drop SwipeSelectingCollectionView.xcodeproj in your project.
  2. Congratulations!

Usage example

Programmatically

import SwipeSelectingCollectionView2

let collectionView = SwipeSelectingCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) 

Added SwipeUICollectionViewDelegate

Delegate when the tap event recognized. If the cell was seleced, deselect the cell item and trigger the delegation didDeselectItemAt, otherwise just trigger the didSelectItemAtByTapped in SwipeUICollectionViewDelegate like blow.

import SwipeSelectingCollectionView2

extension ViewController: SwipeUICollectionViewDelegate {
    func collectionView(_ collectionView: UICollectionView, didSelectItemAtByTapped indexPath: IndexPath) {
        print("didSelectItemAtByTapped: \(indexPath)")
        collectionView.selectItem(at: indexPath, animated: false, scrollPosition: [])
    }
}

Interface Builder

Contribute

We would love you for the contribution to SwipeSelectingCollectionView, check the LICENSE file for more info.

Meta

Original Auther:

Shane Qi – @shadowqiqizengtai@gmail.com

Updated by:

dragonetail – dragonetail@gmail.com

Distributed under the Apache License 2.0. See LICENSE for more information.

https://github.com/shaneqi/SwipeSelectingCollectionView2

You can’t perform that action at this time.