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 4.2
- iOS 9.0+
- Xcode 10.1
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
- Download and drop
SwipeSelectingCollectionView.xcodeproj
in your project. - Congratulations!
import SwipeSelectingCollectionView2
let collectionView = SwipeSelectingCollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
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: [])
}
}
We would love you for the contribution to SwipeSelectingCollectionView, check the LICENSE
file for more info.
Shane Qi – @shadowqi – [email protected]
dragonetail – [email protected]
Distributed under the Apache License 2.0. See LICENSE
for more information.