File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -31,19 +31,20 @@ import UIKit
3131
3232 delegate = self
3333 dataSource = self
34- goto ( startPage)
34+ goTo ( startPage)
3535 }
3636}
3737
3838// MARK: Public methods
3939extension PagesController {
4040
41- public func goto( index: Int ) {
42- if index > - 1 && index < pages. count {
41+ public func goTo( index: Int ) {
42+ if index >= 0 && index < pages. count {
43+ let direction : UIPageViewControllerNavigationDirection = ( index > currentIndex) ? . Forward : . Reverse
4344 let viewController = pages [ index]
4445 currentIndex = index
4546 setViewControllers ( [ viewController] ,
46- direction: ( index > currentIndex ) ? . Forward : . Reverse ,
47+ direction: direction ,
4748 animated: true , completion: nil )
4849 if setNavigationTitle {
4950 title = viewController. title
@@ -52,11 +53,11 @@ extension PagesController {
5253 }
5354
5455 public func next( ) {
55- goto ( currentIndex + 1 )
56+ goTo ( currentIndex + 1 )
5657 }
5758
5859 public func previous( ) {
59- goto ( currentIndex - 1 )
60+ goTo ( currentIndex - 1 )
6061 }
6162
6263 public func add( viewControllers: [ UIViewController ] ) {
You can’t perform that action at this time.
0 commit comments