Classes

The following classes are available globally.

  • Route Handler

    This delegate is provided as a generic base class.

    Feel free to inherit from this base class and override the methods prepareForTransition(to:) and transition(for:).

    See more

    Declaration

    Swift

    open class RouteHandler<R> where R : RouteType
  • The types of presentation transitions for Routes.

    let myTransition = RouteTransition { (source, destination, animated, completion) in
        source.present
    }
    
    See more

    Declaration

    Swift

    public class RouteTransition
    extension RouteTransition: Equatable
  • A routing appliance used to navigate to the start of flows.

    router.navigate(to: .profile(withID: 23))
    
    See more

    Declaration

    Swift

    open class XRouter<R> : RouteHandler<R> where R : RouteType
  • Represents a URL that has been matched to a registered route.

    Provides parameter mapping shortcuts.

    Note

    For use when handling routing parameters.

    Usage:

    // Path components
    let name: String = try $0.path("name")
    let pageId: Int = try $0.path("id")
    
    // Query string parameters
    let all: [String: String] = $0.queryParameters
    let offset: String? = $0.query("offset")
    let page = $0.query("page") ?? 0
    
    // URL Host/Scheme
    let host: String? = $0.host
    let scheme: String? = $0.scheme
    
    See more

    Declaration

    Swift

    public class MatchedURL
  • Path pattern definition for pattern matching

    let pathPattern: PathPattern = "/my/{adjective}/string/{number}"
    
    pathPattern.matches("/my/cool/string/1")       // `true`
    pathPattern.matches("/my/awesome/string/2")    // `true`
    pathPattern.matches("/your/cool/string/3")     // `false`, mismatch on expected static element first
    pathPattern.matches("/my/cool/string/hello")   // `true`
    
    See more

    Declaration

    Swift

    public class PathPattern : ExpressibleByStringLiteral, Hashable
  • Represents a list of URL mappings for a set of paths on some host(s)/scheme(s).

    See more

    Declaration

    Swift

    public class URLMatcher<Route> where Route : RouteType
  • Router URL Path Mapper.

    Note

    All static paths are resolved before dynamic paths.

    Usage:

    // Static path
    $0.map("/users") { .allUsers }
    
    // Dynamic path
    $0.map("/users/{id}/profile") { try .profile(withID: $0.path("id")) }
    
    See more

    Declaration

    Swift

    public class URLPathMapper<Route> where Route : RouteType