Compare commits

...

24 Commits

Author SHA1 Message Date
Sergey 795308668c
Merge pull request #3 from thr1llseek3r/master
Fix scrollToItem forces crash add debugPrint
2021-12-22 14:39:13 +03:00
Sergey f3e95c90ec
Merge pull request #5 from thr1llseek3r/fix_scrollToItem_add_debugPrint
Fix scrollToItem add debugPrint
2021-12-22 11:46:29 +03:00
thrillseek3r 320b4f57bb fix scrollToItem add debugPrint 2021-12-22 11:44:48 +03:00
Sergey 0df6070810
Merge pull request #2 from thr1llseek3r/master
ScrollToItem forces crash in case of index out of range
2021-12-21 16:12:24 +03:00
Sergey c1718fb5c1
Merge pull request #4 from thr1llseek3r/fix_scrollToItem
ScrollToItem forces crash in case of index out of range
2021-12-21 15:54:38 +03:00
Sergey 9bebb56fc1
Merge branch 'master' into fix_scrollToItem 2021-12-21 15:50:35 +03:00
thrillseek3r 15a64b5c3f code review 2021-12-21 15:46:01 +03:00
Sergey bd38b12314
Merge pull request #3 from thr1llseek3r/develop
ScrollToItem forces crash in case of index out of range
2021-12-20 20:28:25 +03:00
Sergey 00dd915191
Merge pull request #2 from thr1llseek3r/fix_scrollToItem_forces_crash
Fix scroll to item forces crash
2021-12-20 20:23:26 +03:00
thrillseek3r aa652bfe05 code review 2021-12-20 20:22:19 +03:00
thrillseek3r 68b82f91e1 fix scrollToItem forces crash in case of index out of range 2021-12-20 19:11:52 +03:00
Wenchao Ding 3acbd3e987
Merge pull request #313 from sereivoanyong/master
Increase swift-tools-version to 5.4
2021-09-27 17:24:20 +08:00
Sereivoan Yong 0560602b2f Increase swift-tools-version to 5.4 2021-05-28 16:59:34 +07:00
Wenchao Ding 1c2aaef6bf
Merge pull request #298 from brennobemoura/master
Fix iOS minimum version and increased Swift tools version
2021-02-16 13:14:01 +08:00
brennoumobi 977ac1f5cf Removed swiftLanguageVersions 2020-12-09 15:24:48 -03:00
brennoumobi a67e26d75d Fix iOS minimum version 2020-12-09 15:19:56 -03:00
Wenchao Ding fba5e9ea70
Merge pull request #293 from dirtmelon/patch-1
Add objc bridges of minimumScale and minimumAlpha.
2020-11-07 09:20:00 +08:00
dirtmelon d25867705f add objc bridges of minimumScale and minimumAlpha. 2020-11-04 17:06:03 +08:00
Wenchao Ding ca03ae6475
Merge pull request #271 from sereivoanyong/master
Fix Package.swift
2020-07-04 11:45:17 +08:00
Wenchao Ding 7a1eac8f0a
Merge pull request #284 from DipanshKhandelwal/patch-1
Transformer Type : Typos in REAMDE
2020-07-04 11:31:41 +08:00
Dipansh Khandelwal 6b4a11fa78
Transformer Type : Typos in REAMDE
crossfading -> crossFading
zoomout -> zoomOut
2020-06-16 21:51:27 +05:30
Maxim Sorokin e61151be2f remove IBDesignable and IBInspectable 2020-05-12 18:31:55 +03:00
Sereivoan Yong 2f16b6f98f Fix Package.swift 2020-01-12 23:24:01 +07:00
Wenchao Ding e535eb1a81
Update README.md 2019-08-26 09:41:39 +08:00
6 changed files with 25 additions and 29 deletions

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -1,3 +1,4 @@
//
// Package.swift
// FSPagerView
@ -24,11 +25,17 @@
// 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"]),
]
)

View File

@ -1,6 +1,6 @@
![fspagerview](https://cloud.githubusercontent.com/assets/5186464/24086370/45e7e8dc-0d49-11e7-86aa-139354fe00c5.jpg)
[![Languages](https://img.shields.io/badge/language-swift%204.2%20|%20objc-FF69B4.svg?style=plastic)](#) <br/>
[![Languages](https://img.shields.io/badge/language-swift%205.0%20|%20objc-FF69B4.svg?style=plastic)](#) <br/>
[![Platform](https://img.shields.io/badge/platform-iOS%20|%20tvOS-blue.svg?style=plastic)](http://cocoadocs.org/docsets/FSPagerView)
[![Version](https://img.shields.io/cocoapods/v/FSPagerView.svg?style=plastic)](http://cocoadocs.org/docsets/FSPagerView)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=plastic)](https://github.com/Carthage/Carthage)
@ -85,7 +85,7 @@ pagerView.interitemSpacing = 10
| ![1](https://cloud.githubusercontent.com/assets/5186464/22686429/1983b97e-ed5f-11e6-9a32-44c1830df7ac.gif) |
```swift
pagerView.transformer = FSPagerViewTransformer(type: .crossfading)
pagerView.transformer = FSPagerViewTransformer(type: .crossFading)
```
---
@ -96,7 +96,7 @@ pagerView.transformer = FSPagerViewTransformer(type: .crossfading)
| ![2](https://cloud.githubusercontent.com/assets/5186464/22686426/19830862-ed5f-11e6-90be-8fb1319cd125.gif) |
```swift
pagerView.transformer = FSPagerViewTransformer(type: .zoomout)
pagerView.transformer = FSPagerViewTransformer(type: .zoomOut)
```
---

View File

@ -8,11 +8,9 @@
import UIKit
@IBDesignable
open class FSPageControl: UIControl {
/// The number of page indicators of the page control. Default is 0.
@IBInspectable
open var numberOfPages: Int = 0 {
didSet {
self.setNeedsCreateIndicators()
@ -20,7 +18,6 @@ open class FSPageControl: UIControl {
}
/// The current page, highlighted by the page control. Default is 0.
@IBInspectable
open var currentPage: Int = 0 {
didSet {
self.setNeedsUpdateIndicators()
@ -28,7 +25,6 @@ open class FSPageControl: UIControl {
}
/// The spacing to use of page indicators in the page control.
@IBInspectable
open var itemSpacing: CGFloat = 6 {
didSet {
self.setNeedsUpdateIndicators()
@ -36,7 +32,6 @@ open class FSPageControl: UIControl {
}
/// The spacing to use between page indicators in the page control.
@IBInspectable
open var interitemSpacing: CGFloat = 6 {
didSet {
self.setNeedsLayout()
@ -44,7 +39,6 @@ open class FSPageControl: UIControl {
}
/// The distance that the page indicators is inset from the enclosing page control.
@IBInspectable
open var contentInsets: UIEdgeInsets = .zero {
didSet {
self.setNeedsLayout()
@ -59,7 +53,6 @@ open class FSPageControl: UIControl {
}
/// Hide the indicator if there is only one page. default is NO
@IBInspectable
open var hidesForSinglePage: Bool = false {
didSet {
self.setNeedsUpdateIndicators()

View File

@ -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) {

View File

@ -74,7 +74,6 @@ public protocol FSPagerViewDelegate: NSObjectProtocol {
}
@IBDesignable
open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelegate {
// MARK: - Public properties
@ -94,7 +93,6 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
}
/// The time interval of automatic sliding. 0 means disabling automatic sliding. Default is 0.
@IBInspectable
open var automaticSlidingInterval: CGFloat = 0.0 {
didSet {
self.cancelTimer()
@ -105,7 +103,6 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
}
/// The spacing to use between items in the pager view. Default is 0.
@IBInspectable
open var interitemSpacing: CGFloat = 0 {
didSet {
self.collectionViewLayout.forceInvalidate()
@ -113,7 +110,6 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
}
/// The item size of the pager view. When the value of this property is FSPagerView.automaticSize, the items fill the entire visible area of the pager view. Default is FSPagerView.automaticSize.
@IBInspectable
open var itemSize: CGSize = automaticSize {
didSet {
self.collectionViewLayout.forceInvalidate()
@ -121,7 +117,6 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
}
/// A Boolean value indicates that whether the pager view has infinite items. Default is false.
@IBInspectable
open var isInfinite: Bool = false {
didSet {
self.collectionViewLayout.needsReprepare = true
@ -130,39 +125,33 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
}
/// An unsigned integer value that determines the deceleration distance of the pager view, which indicates the number of passing items during the deceleration. When the value of this property is FSPagerView.automaticDistance, the actual 'distance' is automatically calculated according to the scrolling speed of the pager view. Default is 1.
@IBInspectable
open var decelerationDistance: UInt = 1
/// A Boolean value that determines whether scrolling is enabled.
@IBInspectable
open var isScrollEnabled: Bool {
set { self.collectionView.isScrollEnabled = newValue }
get { return self.collectionView.isScrollEnabled }
}
/// A Boolean value that controls whether the pager view bounces past the edge of content and back again.
@IBInspectable
open var bounces: Bool {
set { self.collectionView.bounces = newValue }
get { return self.collectionView.bounces }
}
/// A Boolean value that determines whether bouncing always occurs when horizontal scrolling reaches the end of the content view.
@IBInspectable
open var alwaysBounceHorizontal: Bool {
set { self.collectionView.alwaysBounceHorizontal = newValue }
get { return self.collectionView.alwaysBounceHorizontal }
}
/// A Boolean value that determines whether bouncing always occurs when vertical scrolling reaches the end of the content view.
@IBInspectable
open var alwaysBounceVertical: Bool {
set { self.collectionView.alwaysBounceVertical = newValue }
get { return self.collectionView.alwaysBounceVertical }
}
/// A Boolean value that controls whether the infinite loop is removed if there is only one item. Default is false.
@IBInspectable
open var removesInfiniteLoopForSingleItem: Bool = false {
didSet {
self.reloadData()
@ -170,7 +159,6 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
}
/// The background view of the pager view.
@IBInspectable
open var backgroundView: UIView? {
didSet {
if let backgroundView = self.backgroundView {
@ -512,7 +500,8 @@ 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)]")
debugPrint("index \(index) is out of range [0...\(self.numberOfItems-1)]")
return
}
let indexPath = { () -> IndexPath in
if let indexPath = self.possibleTargetingIndexPath, indexPath.item == index {