Skip to content

Commit c431605

Browse files
love4soulchili-ios
authored andcommitted
Fixes #24 (#25)
1 parent a8780e7 commit c431605

10 files changed

+19
-10
lines changed

CHIPageControl.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'CHIPageControl'
3-
s.version = '0.1.2'
3+
s.version = '0.1.3'
44
s.summary = 'CHIPageControl is a set of cool animated page controls written in Swift to replace boring UIPageControl.'
55

66
s.ios.deployment_target = '8.0'

CHIPageControl/CHIPageControlAji.swift

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ open class CHIPageControlAji: CHIBasePageControl {
8484
override func update(for progress: Double) {
8585
guard let min = inactive.first?.frame,
8686
let max = inactive.last?.frame,
87+
numberOfPages > 1,
8788
progress >= 0 && progress <= Double(numberOfPages - 1) else {
8889
return
8990
}

CHIPageControl/CHIPageControlAleppo.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ open class CHIPageControlAleppo: CHIBasePageControl {
5959

6060
override func update(for progress: Double) {
6161
guard progress >= 0 && progress <= Double(numberOfPages - 1),
62-
let firstFrame = self.inactive.first?.frame else { return }
62+
let firstFrame = self.inactive.first?.frame,
63+
numberOfPages > 1 else { return }
64+
6365
let normalized = progress * Double(diameter + padding)
6466
let distance = abs(round(progress) - progress)
6567
let mult = 1 + distance * 2

CHIPageControl/CHIPageControlChimayo.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ open class CHIPageControlChimayo: CHIBasePageControl {
7777
}
7878

7979
override func update(for progress: Double) {
80-
guard progress >= 0 && progress <= Double(numberOfPages - 1) else { return }
80+
guard progress >= 0 && progress <= Double(numberOfPages - 1),
81+
numberOfPages > 1 else { return }
8182

8283
let rect = CGRect(x: 0, y: 0, width: self.diameter, height: self.diameter).insetBy(dx: 1, dy: 1)
8384

CHIPageControl/CHIPageControlFresno.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ open class CHIPageControlFresno: CHIBasePageControl {
9292
override func update(for progress: Double) {
9393
guard let min = self.min,
9494
let max = self.max,
95-
progress >= 0 && progress <= Double(numberOfPages - 1) else {
95+
progress >= 0 && progress <= Double(numberOfPages - 1),
96+
numberOfPages > 1 else {
9697
return
9798
}
9899

CHIPageControl/CHIPageControlJalapeno.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ open class CHIPageControlJalapeno: CHIBasePageControl {
6161

6262
override func update(for progress: Double) {
6363
guard progress >= 0 && progress <= Double(numberOfPages - 1),
64-
let firstFrame = self.inactive.first?.frame else {
64+
let firstFrame = self.inactive.first?.frame,
65+
numberOfPages > 1 else {
6566
return
6667
}
6768
let left = firstFrame.origin.x

CHIPageControl/CHIPageControlJaloro.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ open class CHIPageControlJaloro: CHIBasePageControl {
9393
override func update(for progress: Double) {
9494
guard let min = inactive.first?.frame,
9595
let max = inactive.last?.frame,
96-
progress >= 0 && progress <= Double(numberOfPages - 1) else {
96+
progress >= 0 && progress <= Double(numberOfPages - 1),
97+
numberOfPages > 1 else {
9798
return
9899
}
99100

CHIPageControl/CHIPageControlPaprika.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ open class CHIPageControlPaprika: CHIBasePageControl {
9393

9494
override func update(for progress: Double) {
9595
guard let min = self.min,
96-
let max = self.max else {
96+
let max = self.max,
97+
numberOfPages > 1 else {
9798
return
9899
}
99100
var progress = progress

CHIPageControl/CHIPageControlPuya.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ open class CHIPageControlPuya: CHIBasePageControl {
9292
override func update(for progress: Double) {
9393
guard let min = self.min,
9494
let max = self.max,
95-
progress >= 0 && progress <= Double(numberOfPages - 1) else {
95+
progress >= 0 && progress <= Double(numberOfPages - 1),
96+
numberOfPages > 1 else {
9697
return
9798
}
9899

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Just add the `CHIPageControl` folder to your project.
2525

2626
use [CocoaPods](https://cocoapods.org) with Podfile:
2727
``` ruby
28-
pod 'CHIPageControl', '~> 0.1.2'
28+
pod 'CHIPageControl', '~> 0.1.3'
2929

3030
# individual page control
3131
pod 'CHIPageControl/Aji'
@@ -41,7 +41,7 @@ pod 'CHIPageControl/Puya'
4141

4242
use [Carthage](https://github.com/Carthage/Carthage) with Cartfile
4343
```ogdl
44-
github "ChiliLabs/CHIPageControl" ~> 0.1.2
44+
github "ChiliLabs/CHIPageControl" ~> 0.1.3
4545
```
4646

4747

0 commit comments

Comments
 (0)