Skip to content

Need help to print url from route #65

Answered by mmllr
trispo asked this question in Q&A
Discussion options

You must be logged in to vote

You need to add the .case in the router to make it a ParserPrinter:

enum TestRoute {
    case foo(String)
}

let theRouter = OneOf {
    Route(.case(TestRoute.foo)) {
            Path {
                "foo"
                Parse(.string)
            }
        }
}

let url = try theRouter
        .baseURL("https://my-host.app")
        .url(for: .foo("1234"))

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@saroar
Comment options

@trispo
Comment options

@mmllr
Comment options

@trispo
Comment options

@trispo
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by trispo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants