I've successfully used the following to get the tmp/
directory in iOS:
let path = NSURL.fileURL(withPath: NSTemporaryDirectory(), isDirectory: true)
API docs would seem to prefer we use FileManager to get the Documents/
directory:
let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
Is there a way to use FileManager.default.urls(for:in:)
or something similar to get the tmp/
directory in iOS? I tried .itemReplacementDirectory
and .url(for:in:appropriateFor:create:)
, but they didn't work.
Any help/guidance would be greatly appreciated!
Swift 3, iOS 10
The correct answer is simply:
let tmpURL = FileManager.default.temporaryDirectory
Sometimes, you just need to take a break and come back to it later... =)