Merge pull request #3 from thr1llseek3r/develop
ScrollToItem forces crash in case of index out of range
This commit is contained in:
commit
bd38b12314
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// swift-tools-version:5.4
|
||||
// swift-tools-version:5.0
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue