Swiftpack.co -  DeluxeAlonso/DLAutoSlidePageViewController as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
DeluxeAlonso/DLAutoSlidePageViewController
Auto slide PageViewController written in Swift.
.package(url: "https://github.com/DeluxeAlonso/DLAutoSlidePageViewController.git", from: "2.0.0")

DLAutoSlidePageViewController

Version License Platform Swift 5

Demo

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

DLAutoSlidePageViewController requires iOS 10.0 and Swift 4.0 or above.

Installation

CocoaPods

PageViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "DLAutoSlidePageViewController"

Swift Package Manager

To integrate using Swift Package Manager, add the following as a dependency to your Package.swift:

.package(url: "https://github.com/DeluxeAlonso/DLAutoSlidePageViewController.git", .upToNextMajor(from: "1.2.0"))

Usage

Create an instance of DLAutoSlidePageViewController and provide it with an array of UIViewController's.

let firstVC = storyboard?.instantiateViewController(withIdentifier: 'FirstVC')
let secondVC = storyboard?.instantiateViewController(withIdentifier: 'SecondVC')
let pages = [firstVC, secondVC]

let pageViewController = DLAutoSlidePageViewController(pages: pages)
                                                       
addChildViewController(pageViewController)
containerView.addSubview(pageViewController.view)
pageViewController.view.frame = containerView.bounds

Appearance and presentation configuration

There are two ways to configure the appearance and presentation of DLAutoSlidePageViewController:

  1. You can do it globally using the DefaultAutoSlideConfiguration class before instantiation.
let pages = [firstVC, secondVC]

DefaultAutoSlideConfiguration.shared.timeInterval = 5.0
DefaultAutoSlideConfiguration.shared.interPageSpacing = 3.0
DefaultAutoSlideConfiguration.shared.hidePageControl = false
let pageViewController = DLAutoSlidePageViewController(pages: pages)
  1. You can create your own configuration instance that conforms to AutoSlideConfiguration protocol and pass it on DLAutoSlidePageViewController's initializer.
struct CustomConfiguration: AutoSlideConfiguration {
    var timeInterval: TimeInterval = 10.0
    var navigationOrientation: UIPageViewController.NavigationOrientation = .vertical
}
let pages = [firstVC, secondVC]
let pageViewController = DLAutoSlidePageViewController(pages: pages, configuration: CustomConfiguration())

Available configuration properties

DLAutoSlidePageViewController can be customized via the following properties:

Property Type Description
timeInterval TimeInterval Time interval to be used for each page automatic transition.
transitionStyle UIPageViewController.TransitionStyle Styles for the page-turn transition.
navigationOrientation UIPageViewController.NavigationOrientation Orientations for page-turn transitions.
navigationDirection UIPageViewController.NavigationDirection Directions for page-turn transitions.
interPageSpacing Float Space between pages.
spineLocation UIPageViewController.SpineLocation Locations for the spine. Only valid if the transition style is UIPageViewController.TransitionStyle.pageCurl.
hidePageControl Bool Decides if page control is going to be shown or not.
currentPageIndicatorTintColor UIColor The tint color to be used for the current page indicator.
pageIndicatorTintColor UIColor The tint color to be used for the page indicator.
pageControlBackgroundColor UIColor The background color to be used for the page control.
shouldAnimateTransition Bool Indicates whether the automatic transition is to be animated.

Author

Alonso Alvarez, alonso.alvarez.dev@gmail.com

License

DLAutoSlidePageViewController is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 10
Last commit: 6 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Removed deprecated methods
6 days ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API