BMGallery supplies a easy way to simply use, create a transition animation like TikTok, apply to a situation that a UICollectionCell push into a detail UIViewController.
To run the example project, clone the repo, and run pod install
from the Example directory first.
bmoGallery.delegate = self
bmoGallery.dataSource = self
bmoGallery.layoutType = .aspect(ratio: 30 / 23, itemCountOfLine: 3, margin: 8.0)
func bmGalleryDataSourceNumberOfItems(in galleryView: BMGallery) -> Int {
return datas.count
}
func bmGalleryDataSourceContentViewForItem(at: Int, contentView: UIView) {
}
galleryView.transition.push(vc, to: navigationController, fromItem: at)
caution: the detail page must implement BMGalleryTransitioningDestination, must use sourceBMGallery to pop out
class DetailViewController: UIViewController, BMGalleryTransitioningDestination {
@IBAction func closeAction(_ sender: Any) {
self.sourceBMGallery?.transition.pop(from: navigationController)
}
}
iOS 9.0 + Swift 5
BMGallery is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BMGallery'
LEE ZHE YU, tzef8220@gmail.com
BMGallery is available under the MIT license. See the LICENSE file for more info.