Merge pull request #3 from thr1llseek3r/develop

ScrollToItem forces crash in case of index out of range
This commit is contained in:
Sergey 2021-12-20 20:28:25 +03:00 committed by GitHub
commit bd38b12314
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -11,11 +11,11 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/WenchaoD/FSPagerView.git", :tag => s.version.to_s }
s.platform = :ios
s.ios.deployment_target = '9.0'
s.ios.deployment_target = '8.0'
s.requires_arc = true
s.framework = 'UIKit'
s.source_files = 'Sources/*.{swift,h,m}'
s.swift_version = '5.3'
s.swift_version = '5.0'
s.cocoapods_version = '>= 1.4.0'
end

View File

@ -1,4 +1,4 @@
// swift-tools-version:5.4
// swift-tools-version:5.0
import PackageDescription
let package = Package(

View File

@ -512,7 +512,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
@objc(scrollToItemAtIndex:animated:)
open func scrollToItem(at index: Int, animated: Bool) {
guard index < self.numberOfItems else {
fatalError("index \(index) is out of range [0...\(self.numberOfItems-1)]")
return
}
let indexPath = { () -> IndexPath in
if let indexPath = self.possibleTargetingIndexPath, indexPath.item == index {