Pageboy alternatives and similar libraries
Based on the "Pagination" category.
Alternatively, view Pageboy alternatives based on common mentions on social networks and blogs.
-
CHIPageControl
A set of cool animated page controls written in Swift to replace boring UIPageControl. Mady by @ChiliLabs - https://chililabs.io -
PageControls
This is a selection of custom page controls to replace UIPageControl, inspired by a dribbble found here: https://dribbble.com/shots/2578447-Page-Control-Indicator-Transitions-Collection -
SlideController
Swipe between pages with an interactive title navigation control. Configure horizontal or vertical chains for unlimited pages amount.
Appwrite - The open-source backend cloud platform
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Pageboy or a related project?
README
TL;DR UIPageViewController done properly.
โญ๏ธ Features
- [x] Simplified data source management & enhanced delegation.
- [x] Dynamically insert & remove pages.
- [x] Infinite scrolling support.
- [x] Automatic timer-based page transitioning.
- [x] Support for custom animated page transitions.
๐ Requirements
Pageboy requires iOS 9 / tvOS 10; and is compatible with Swift 5.
๐ฒ Installation
Swift Package Manager
Pageboy is compatible with Swift Package Manager and can be integrated via Xcode.
CocoaPods
Pageboy is also available through CocoaPods:
pod 'Pageboy', '~> 3.6'
Carthage
Pageboy is also available through Carthage:
github "uias/Pageboy" ~> 3.6
๐ Usage
The Basics
1) Create an instance of a PageboyViewController
and provide it with a PageboyViewControllerDataSource
.
class PageViewController: PageboyViewController, PageboyViewControllerDataSource {
override func viewDidLoad() {
super.viewDidLoad()
self.dataSource = self
}
}
2) Implement the PageboyViewControllerDataSource
functions.
func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int {
return viewControllers.count
}
func viewController(for pageboyViewController: PageboyViewController,
at index: PageboyViewController.PageIndex) -> UIViewController? {
return viewControllers[index]
}
func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? {
return nil
}
PageboyViewControllerDelegate
The delegate functions provided by a PageboyViewController
are much more reliable and useful than what a raw UIPageViewController
provides. You can use them to find out exactly where the current page is, and when it's moved, where it's headed.
willScrollToPageAtIndex
About to embark on a transition to a new page.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
willScrollToPageAt index: Int,
direction: NavigationDirection,
animated: Bool)
didScrollToPosition
Scrolled to a relative position along the way transitioning to a new page.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didScrollTo position: CGPoint,
direction: NavigationDirection,
animated: Bool)
didScrollToPage
Successfully completed a scroll transition to a page.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didScrollToPageAt index: Int,
direction: NavigationDirection,
animated: Bool)
didReload
Child view controllers have been reloaded.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didReloadWith currentViewController: UIViewController,
currentPageIndex: PageIndex)
Navigation
You can navigate programmatically through a PageboyViewController
using scrollToPage()
:
pageViewController.scrollToPage(.next, animated: true)
- Infinite scrolling can be enabled with
.isInfiniteScrollEnabled
. - Interactive scrolling can also be controlled with
.isScrollEnabled
.
Insertion & Deletion
Pageboy provides the ability to insert and delete pages dynamically in the PageboyViewController
.
func insertPage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)
func deletePage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)
This behaves similarly to the insertion of rows in UITableView
, in the fact that you have to update the data source prior to calling any of the update functions.
Example:
let index = 2
viewControllers.insert(UIViewController(), at: index)
pageViewController.insertPage(at: index)
The default behavior after inserting or deleting a page is to scroll to the update location, this however can be configured by passing a PageUpdateBehavior
value other than .scrollToUpdate
.
โก๏ธ Other Extras
reloadData()
- Reload the view controllers in the page view controller. (Reloads the data source)..navigationOrientation
- Whether to orientate the pages horizontally or vertically..currentViewController
- The currently visible view controller if it exists..currentPosition
- The exact current relative position of the page view controller..currentIndex
- The index of the currently visible page..parentPageboy
- Access the immediate parentPageboyViewController
from any child view controller.
Animated Transitions
Pageboy also provides custom transition support for animated transitions. This can be customized via the .transition
property on PageboyViewController
.
pageboyViewController.transition = Transition(style: .push, duration: 1.0)
Note: By default this is set to nil
, which uses the standard animation provided by UIPageViewController
.
Auto Scrolling
PageboyAutoScroller
is available to set up timer based automatic scrolling of the PageboyViewController
:
pageboyViewController.autoScroller.enable()
Support for custom intermission duration and other scroll behaviors is also available.
๐จ๐ปโ๐ป About
- Created by Merrick Sapsford (@MerrickSapsford)
- Contributed to by a growing list of others.
โค๏ธ Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/uias/Pageboy.
๐ฎ๐ปโโ๏ธ License
The library is available as open source under the terms of the MIT License.
*Note that all licence references and agreements mentioned in the Pageboy README section above
are relevant to that project's source code only.