I previously had the call to getReplacementsMap like this: let map = getReplacementsMap(plugin: String, pluginType: String);
but Xcode was complaining that Cannot convert value of type 'String.Type' to expected argument type 'String'
I've fixed it so that Xcode doesn't throw a wobbly, but I don't understand the reasoning behind this. I gather that String.Type is a meta-type but I don't understand wht Xcode thought I was using them!
let map = getReplacementsMap(plugin: "hello", pluginType: "this is a string");
then it works fine: plugin: is the label for the argument, and "hello" is the value.
In your case, you have a variable containing a string you want to use, so you need to replace "hello" with this variable. The variable might have the same name as the label, but you still need to spell both:
let map = getReplacementsMap(plugin: plugin, pluginType: "this is a string");
If instead you put the type, then the compiler assumes you're trying to pass a metatype object to the function, and you get the error you got:
let map = getReplacementsMap(plugin: String, pluginType: "this is a string");
Note that this is not the correct way to spell the metatype either (you should use String.self for that), but the compiler isn't sure of what you're trying to do and takes a guess in its error message (a wrong one in this case).
Aha! I think I get it now. So the motivation for the way that Swift does it, is primarily to match the source with the destination, where most/all other languages put specifying the type of the parameter as the crucial thing to get right. I'm not sure I've worded it that well...
Thanks for the explanations! Would I be correct in guessing that I am not the first person with whom you have had this conversation?