func f<T>(t: T? = nil, /* other parameters with default values */) {}
which worked fine until I realized that f cannot be called without a value for generic parameter because Generic parameter 'T' could not be inferred.
Changing to
func f<T>(t: T? = nil as String?, /* other ... */) {}
fixes the issue, that is calls such as f() compile, but that feels kind of ugly, for example any concrete type completely known to the compiler will do in the nil as String? part so how to choose the right one?
Is there a better way to do what I want, that is for the function to still be generic and allow calling without the T parameter when the default nil is acceptable?