Why does Swift has a restriction for single argument tuple with naming parameter?

I am speaking of

typealias RequestParameters = (url: URL) // Not allowed

It would be really convenient to me if I could define a tuple ( single? ) with one argument and with a naming parameter.

Could we move forward with this and discuss disadvantages/advantages of this feature? It seems easy to implement...

Workaround

As a workaround for this feature, we could define a tuple with latest parameter as Void. Ugly, but we could.

typealias RequestParameters = (url: URL, Void) // Not allowed

This example reminds me about [NSArray arrayWithValues: first, second, third, nil]

1 Like

Some links:


1 Like
Terms of Service

Privacy Policy

Cookie Policy