init(for:in:appropriateFor:create:)
Creates a file URL for a common directory in a domain.
Declaration
init(for directory: FileManager.SearchPathDirectory, in domain: FileManager.SearchPathDomainMask, appropriateFor url: URL? = nil, create shouldCreate: Bool = false) throwsParameters
- directory:
The search path for the commonly used directory, such as Desktopdirectory or Downloadsdirectory.
- domain:
The file system domain to search, which the values in Searchpathdomainmask define. Specify only one domain for this parameter. You may not specify Alldomainsmask with this initializer.
- url:
The file URL for determining the location of the returned URL. Only the volume of this parameter is relevant.
The initializer ignores this parameter unless the directory parameter contains the value Itemreplacementdirectory and the domain parameter contains the value Userdomainmask.
- shouldCreate:
A Boolean value that indicates whether the initializer creates the directory if it doesn’t already exist.