RouteType

public protocol RouteType : Equatable

Defines the minimum requirements for describing a list of routes.

Note

Your Route enum should inherit from this protocol.
enum MyRoutes: RouteType {
    case homePage
    case profilePage(profileID: Int)
    ...

Properties

  • identifier Default implementation

    Route name.

    Note

    Default implementation provided.

    Default Implementation

    Unique identifier for equality checks. (default: includes parameters)

    Declaration

    Swift

    var identifier: String { get }
  • uniqueOnParameters Default implementation

    Include parameters when calculating uniqueness.

    Default Implementation

    Includes any parameters when calculating uniqueness. (default: true)

    Declaration

    Swift

    var uniqueOnParameters: Bool { get }

Methods

  • registerURLs() Default implementation

    Register a URL matcher group.

    Example:

    return .group(["website.com", "sales.website.com"]) {
        $0.map("products") { .allProducts(page: $0.query("page") ?? 0) }
        $0.map("products/{category}/") { try .productsShowcase(category: $0.path("category")) }
        $0.map("user/*/logout") { .userLogout }
    }
    

    Default Implementation

    Register URLs (default: none)

    Declaration

    Swift

    static func registerURLs() -> URLMatcherGroup<Self>?

Equatable

  • ==(_:_:) Extension method

    Equatable (default: Compares on String representation of self)

    Declaration

    Swift

    public static func == (lhs: Self, rhs: Self) -> Bool

Computed properties

  • name Extension method

    Route name. Example: myProfileView(withID: Int) becomes “myProfileView”

    Declaration

    Swift

    public var name: String { get }