From 68b82f91e1e35d678ad8a39a5b96c3db2fbdccbf Mon Sep 17 00:00:00 2001 From: thrillseek3r Date: Mon, 20 Dec 2021 19:11:52 +0300 Subject: [PATCH 1/2] fix scrollToItem forces crash in case of index out of range --- Sources/FSPagerView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/FSPagerView.swift b/Sources/FSPagerView.swift index 7fb17d9..dd54eba 100644 --- a/Sources/FSPagerView.swift +++ b/Sources/FSPagerView.swift @@ -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 { From aa652bfe05866992aef81705e8c570948d20e586 Mon Sep 17 00:00:00 2001 From: thrillseek3r Date: Mon, 20 Dec 2021 20:22:19 +0300 Subject: [PATCH 2/2] code review --- FSPagerView.podspec | 4 ++-- Package.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FSPagerView.podspec b/FSPagerView.podspec index a39b4e4..cbf945f 100644 --- a/FSPagerView.podspec +++ b/FSPagerView.podspec @@ -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 diff --git a/Package.swift b/Package.swift index 5febfa1..089fee2 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.4 +// swift-tools-version:5.0 import PackageDescription let package = Package(