Merge pull request #2 from thr1llseek3r/fix_scrollToItem_forces_crash
Fix scroll to item forces crash
This commit is contained in:
commit
00dd915191
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
|
@ -1,34 +1,15 @@
|
|||
//
|
||||
// Package.swift
|
||||
// FSPagerView
|
||||
//
|
||||
// Created by Wenchao Ding on 22/02/2017.
|
||||
// Copyright © 2017 Wenchao Ding. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
// swift-tools-version:5.0
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "FSPagerView",
|
||||
dependencies : [],
|
||||
exclude: []
|
||||
platforms: [
|
||||
.iOS(.v9)
|
||||
],
|
||||
products: [
|
||||
.library(name: "FSPagerView", targets: ["FSPagerView"]),
|
||||
],
|
||||
targets: [
|
||||
.target(name: "FSPagerView", path: "Sources", exclude: ["FSPagerViewObjcCompat.h", "FSPagerViewObjcCompat.m"]),
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||

|
||||
|
||||
[](#) <br/>
|
||||
[](#) <br/>
|
||||
[](http://cocoadocs.org/docsets/FSPagerView)
|
||||
[](http://cocoadocs.org/docsets/FSPagerView)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
|
|
@ -85,7 +85,7 @@ pagerView.interitemSpacing = 10
|
|||
|  |
|
||||
|
||||
```swift
|
||||
pagerView.transformer = FSPagerViewTransformer(type: .crossfading)
|
||||
pagerView.transformer = FSPagerViewTransformer(type: .crossFading)
|
||||
```
|
||||
---
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ pagerView.transformer = FSPagerViewTransformer(type: .crossfading)
|
|||
|  |
|
||||
|
||||
```swift
|
||||
pagerView.transformer = FSPagerViewTransformer(type: .zoomout)
|
||||
pagerView.transformer = FSPagerViewTransformer(type: .zoomOut)
|
||||
```
|
||||
---
|
||||
|
||||
|
|
@ -417,4 +417,4 @@ func pagerViewDidEndDecelerating(_ pagerView: FSPagerView)
|
|||
|
||||
---
|
||||
|
||||
# [Documentation](http://cocoadocs.org/docsets/FSPagerView)
|
||||
# [Documentation](http://cocoadocs.org/docsets/FSPagerView)
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ open class FSPagerViewTransformer: NSObject {
|
|||
open internal(set) weak var pagerView: FSPagerView?
|
||||
open internal(set) var type: FSPagerViewTransformerType
|
||||
|
||||
open var minimumScale: CGFloat = 0.65
|
||||
open var minimumAlpha: CGFloat = 0.6
|
||||
@objc open var minimumScale: CGFloat = 0.65
|
||||
@objc open var minimumAlpha: CGFloat = 0.6
|
||||
|
||||
@objc
|
||||
public init(type: FSPagerViewTransformerType) {
|
||||
|
|
|
|||
|
|
@ -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