|
|
|
|
|
by fauigerzigerk
3157 days ago
|
|
I realise that you tried to work with the same constraints as the Go solution for the sake of argument. But the whole rationale for having 3/ in the first place isn't valid in Swift, so it seems to me that the obvious Swift solution is to use an enum per operation. |
|
I spent a bit more time on the problem, and now i'm pretty sure it is also not solvable "cleanly" in swift, because it actually would need to model some kind of constraints over the accepted values of a type for a parameter.
Something like get(opt: Options<restrictedTo [.prefix, .revision]>... )
Otherwise you'll need to manually create a subenum, and manually compare cases from the original one with the sub one.