Is there an official documentation/description for the keyword "for" in parameter list?

I see the keyword for used in a func's parameter list such as func prepare(for name: String). In googling it, I didn't find any result from https://docs.swift.org or Swift - Resources - Apple Developer. I've found various discussions and have an idea of what it is. But I'm hoping to get a full documentation for it.

In this context, the word "for" is not the Swift keyword for (used in a for-in loop) but an argument label — it has no special meaning here, and could be replaced with any text. It is just acting as a preposition so that the interface of the method reads clearly as "prepare for <name>" (as opposed to, for example, "prepare <name>", or "prepare with <name>", etc.)

4 Likes

Thank you @itaiferber! I was on the wrong route of googling "for" as a keyword.

2 Likes