PaginatorContext

struct PaginatorContext : Codable

Context required for a paginator control. A page may include “paginator.leaf” multiple times to place multiples of the same paginator, but the context is set up to only allow one paginator per page, at a path of “/paginator” from the context root. I could enforce this with a protocol, but … meh.

  • Declaration

    Swift

    struct PageInfo : Codable
  • Declaration

    Swift

    var prevPageURL: String?
  • Declaration

    Swift

    var nextPageURL: String?
  • Declaration

    Swift

    var lastPageURL: String?
  • Declaration

    Swift

    var pageURLs: [PageInfo]
  • Works with “paginator.leaf”. Builds a paginator control allowing navigation to different pages in a N-page array.

    Parameters:

    • start: A 0-based index indicating the first piece of content to show. This is generally the topmost item displayed on the current page.
    • total: The total number of items in the list. The paginator will break this up into N pages. The UI may not create a button for every page.
    • limit: The maximum number of items to show per page. If the ‘item’ size is a page, set this to 1.
    • urlForPage: A closure that takes a page index and returns a relative URL that will load that page.

    Declaration

    Swift

    init(start: Int, total: Int, limit: Int, urlForPage: (Int) -> String)
  • Declaration

    Swift

    init(_ paginator: Paginator, urlForPage: (Int) -> String)