Pagination

public struct Pagination

The Pagination struct represents all the pagination info that can be returned via an API call, often containing a first, previous, next, and last page. This struct represents all those pages as Page instances.

  • The first page of results.

    Declaration

    Swift

    public let first: Page?
  • The previous page of results.

    Declaration

    Swift

    public let previous: Page?
  • The next page of results.

    Declaration

    Swift

    public let next: Page?
  • The last page of results.

    Declaration

    Swift

    public let last: Page?
  • Initializes the struct with a first, previous, next, and last page.

    Declaration

    Swift

    public init(first: Page? = nil, previous: Page? = nil, next: Page? = nil, last: Page? = nil)

    Parameters

    first

    The first page of results.

    previous

    The previous page of results.

    next

    The next page of results.

    last

    The last page of results.

  • Initializes a new instance from the headers of an API response.

    Declaration

    Swift

    public init?(headers: [AnyHashable : Any])

    Parameters

    headers

    The headers of the API response.

  • Initializes a new instance from a URLResponse, extracting the information out of the Link header (if present).

    Declaration

    Swift

    public init?(response: URLResponse?)

    Parameters

    response

    An instance of URLResponse.