PageCoordinator
open class PageCoordinator<RouteType> : BaseCoordinator<RouteType, PageTransition> where RouteType : Route
PageCoordinator provides a base class for your custom coordinator with a UIPageViewController rootViewController.
Note
PageCoordinator sets the dataSource of the rootViewController to reflect the parameters in the initializer.-
The dataSource of the rootViewController.
Feel free to change the pages at runtime. To reflect the changes in the rootViewController, perform a
settransition as well.Declaration
Swift
public let dataSource: UIPageViewControllerDataSource
-
Creates a PageCoordinator with several sequential (potentially looping) pages.
It further sets the current page of the rootViewController animated in the specified direction.
Note
If you need custom configuration of the rootViewController, modify the
configurationparameter, since you cannot change this after the initialization.Declaration
Swift
public init(rootViewController: RootViewController = .init(), pages: [Presentable], loop: Bool = false, set: Presentable? = nil, direction: UIPageViewController.NavigationDirection = .forward)Parameters
pagesThe pages of the PageCoordinator. These can be changed later, if necessary, using the
PageCoordinator.dataSourceproperty.loopWhether or not the PageCoordinator should loop when hitting the end or the beginning of the specified pages.
setThe presentable to be shown right from the start. This should be one of the elements of the specified pages. If not specified, no
settransition is triggered, which results in the first page being shown.directionThe direction in which the transition to set the specified first page (parameter
set) should be animated in. If you specifynilforset, this parameter is ignored.configurationThe configuration of the rootViewController. You cannot change this configuration later anymore (Limitation of UIKit).
-
Creates a PageCoordinator with a custom dataSource. It further sets the currently shown page and a direction for the animation of displaying it. If you need custom configuration of the rootViewController, modify the
configurationparameter, since you cannot change this after the initialization.Declaration
Swift
public init(rootViewController: RootViewController = .init(), dataSource: UIPageViewControllerDataSource, set: Presentable, direction: UIPageViewController.NavigationDirection)Parameters
dataSourceThe dataSource of the PageCoordinator.
setThe presentable to be shown right from the start. This should be one of the elements of the specified pages. If not specified, no
settransition is triggered, which results in the first page being shown.directionThe direction in which the transition to set the specified first page (parameter
set) should be animated in. If you specifynilforset, this parameter is ignored.configurationThe configuration of the rootViewController. You cannot change this configuration later anymore (Limitation of UIKit).
View on GitHub
PageCoordinator Class Reference