Convenient subclass of UIPageViewController
- Very simple safe usage.
- Cycled mode for 3+ pages.
- Allows disabling bounces for edge pages.
- Allows to handle UITableView cell swipes within pages.
- Allows hiding PageControl.
- Smart methods excluding well-know crashes (https://stackoverflow.com/questions/42833765/assertion-failure-in-uipageviewcontroller).
- Pure Swift 5.
- Swift
// Create array of pages
let source: [UIViewController] = ...
// Create pageController with interPageSpacing
let pageController = AMPageViewController(interPageSpacing: 2)
// Set looping mode
pageController.looping = true
// Shows pageControl
pageController.showPageControl = true
// Allows to handle UITableView cell swipes within pages
pageController.allowsTableCellSwipes = true
// Allows bounces for edge pages
pageController.bounceEnabled = true
// Set viewController to show by pageIndex between 0 and source.count
pageController.pageIndex = 0
// Set source array
pageController.source = source
// Then set delegate to observe navigation
pageController.delegate = ...
- Objective-C
// Create array of pages
NSArray<UIViewController *> *source = ...;
AMPageViewController *pageController = [[AMPageViewController alloc] initWithNavigationOrientation:UIPageViewControllerNavigationOrientationHorizontal interPageSpacing:2];
pageController.looping = YES;
pageController.allowsTableCellSwipes = YES;
pageController.bounceEnabled = YES;
pageController.showPageControl = YES;
pageController.source = source;
pageController.pageIndex = 0;
pageController.delegate = ...;
Download and drop AMPageViewController.swift
file in your project.
- Swift 5
- iOS 10 or higher
- Alexey Matveev - malex
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
This project is licensed under the MIT License.