Apple's instructions for creating a temporary URL are to use FileManager.url(for:in:appropriateFor:create:)
.
The example they give is (rewritten in Swift 3):
let desktopURL = URL(fileURLWithPath: "/Users/Noah/Desktop/")
do {
let temporaryDirectoryURL = try FileManager.default.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: desktopURL, create: true)
} catch {
// handle error
}
The docs say that the appropriateFor
parameter "determines the volume of the returned URL", but I don't understand what that means. What is this parameter for and how should I determine the URL to pass in for it?
URL
, notNSURL
andFileManager
, notNSFileManager
. It will be easier to answer your Swift 3 question if you post actual Swift 3 code using the updated APIs. – Twyla