The documentation here seems to be incomplete. There is no explanation of the appropriateFor property that is being passed in the example.
I do not understand the relevance of a desktop URL being passed in this example to create a temporary directory.
Example code I have found seem to always pass 'nil' to this property.
Doc says:
… for the domain parameter, and a URL for the url parameter which determines the volume of the returned URL.
domain and url are the parameters names (not the labels):
func url(for directory: FileManager.SearchPathDirectory, in domain: FileManager.SearchPathDomainMask, appropriateFor url: URL?, create shouldCreate: Bool) throws -> URL
So they effectively refer to in
and appropriateFor
parameters labels.
Passing nil for url means you ignore it and you do not specify url volume.