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
StaticIdentifier
supplied. If you have a page such asLoadingPage
which conforms toStaticIdentifiable
, thenLoadingPage.id
is the standardized way to share this informationDeclaration
Swift
func presentPage(_ pageId: StaticIdentifier)
Parameters
pageId
the
StaticIdentifier
used to navigate to the proper page. The page must be registered already via a call toaddPage
-
Presents the previous page by invoking the
presentPage
function. WepopLast()
twice in order to remove both the current and previous pages.Declaration
Swift
func presentPreviousPage(offset: Int = 0)
Parameters
offset
the offset to pop from (the number of pages to go back to + last one).
-
This subscript operator allows the retrieval of the actual
ContentPage
instance as it is registered. The key to do so should be theStaticIdentifier
from the class itself. AllContentPage
s conform toStaticIdentifiable
and as such the class name plus.id
should be sufficient as a key for the instance desired.An example of this would be
LoadingPage
. To retrieve the previously registeredLoadingPage
instance, 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()