ContentRouter
class ContentRouter
The core navigation method within the SDK is the ContentRouter. Without this class not much could be accomplished and navigating from one page to another within the pay sheet would simply not be possible.
-
Closure type used for page change notifications
Declaration
Swift
typealias PageChangeHandler = (ContentPage, ContentPage) -> Void -
The page that the UX is currently displaying
Declaration
Swift
var currentPage: ContentPage { get set } -
The list of pages this router has registered.
Declaration
Swift
var pages: [ContentPage] { get set } -
Presents the actual page represented by the
StaticIdentifiersupplied. If you have a page such asLoadingPagewhich conforms toStaticIdentifiable, thenLoadingPage.idis the standardized way to share this informationDeclaration
Swift
func presentPage(_ pageId: StaticIdentifier)Parameters
pageIdthe
StaticIdentifierused to navigate to the proper page. The page must be registered already via a call toaddPage -
Presents the previous page by invoking the
presentPagefunction. WepopLast()twice in order to remove both the current and previous pages.Declaration
Swift
func presentPreviousPage(offset: Int = 0)Parameters
offsetthe offset to pop from (the number of pages to go back to + last one).
-
This subscript operator allows the retrieval of the actual
ContentPageinstance as it is registered. The key to do so should be theStaticIdentifierfrom the class itself. AllContentPages conform toStaticIdentifiableand as such the class name plus.idshould be sufficient as a key for the instance desired.An example of this would be
LoadingPage. To retrieve the previously registeredLoadingPageinstance, a call toPaysheet.shared[LoadingPage.id]would yield that object. It is a recommendation that the static helper subscript be used instead; soPaysheet[LoadingPage.id]Declaration
Swift
subscript(index: StaticIdentifier) -> ContentPage { get set } -
Semantic method that indicates that something worth invoking height change and that may not automatically be picked up has occurred and the paysheet should display itself again.
Declaration
Swift
func updatePage()
View on GitHub
Install in Dash
ContentRouter Class Reference